尝试在 C 中使用 cvCreateHist 时检测到 glibc

发布于 2024-12-25 06:16:32 字数 369 浏览 1 评论 0原文

这是我代码的一部分

int histsize=16;
float range=[0,255];
float* ranges[] = { range };
bool uniform=true;
CvHistogram* hist = cvCreateHist(1, &histsize, CV_HIST_ARRAY, ranges, uniform);

但是当我尝试执行 cvCreateHist 时,程序终止并抛出错误 * glibc 检测到 malloc(): 内存损坏: 0x083109b8 **

我正在 eclipse、Ubuntu 中工作。请帮助我。

This is a part of my code

int histsize=16;
float range=[0,255];
float* ranges[] = { range };
bool uniform=true;
CvHistogram* hist = cvCreateHist(1, &histsize, CV_HIST_ARRAY, ranges, uniform);

But when I try to execute cvCreateHist the program terminates and throws an error saying
* glibc detected malloc(): memory corruption: 0x083109b8 **

I am working in eclipse,Ubuntu.Please help me out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜空下最亮的亮点 2025-01-01 06:16:32

事实是,由于以下几行,您的代码甚至不应该编译

float range=[0,255];

bool uniform=true;1

在回答这个问题之前,我必须说我认为您可以从这篇文章中受益匪浅:写出完美的问题

我不知道你在说什么正在尝试完全使用该代码,但以下编译 &不崩溃:

int histsize = 16;
float range[] = { 0, 255 };
float* ranges[] = { range };
bool uniform = true;
CvHistogram* hist = cvCreateHist(1, &histsize, CV_HIST_ARRAY, ranges, uniform);

The truth is that your code shouldn't even compile because of these lines:

float range=[0,255];

bool uniform=true;1

Before answering this question, I must say that I think you can benefit a lot from this post: Writing the perfect question

I don't know what you are trying to do exactly with that code, but the following compiles & doesn't crash:

int histsize = 16;
float range[] = { 0, 255 };
float* ranges[] = { range };
bool uniform = true;
CvHistogram* hist = cvCreateHist(1, &histsize, CV_HIST_ARRAY, ranges, uniform);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文