Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Create a two channels blob for dnn::Net

int sz[] = { 1, 2, 128, 128}; cv::Mat blob = Mat(4, sz, CV_32F);

cv::Mat img1 = cv::imread("left_img.jpg", IMREAD_GRAYSCALE); cv::Mat img2 = cv::imread("right_img.jpg", IMREAD_GRAYSCALE); img1.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 0)))); img2.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 1)))); net.setInput(blob, "input"); //set the network input Mat result = net.forward(); //compute output

However, this give me error

tensorflow_model_loader': malloc():

What is the correct way of passing two channels blob into dnn::Net?

smallbin double linked list corrupted: 0x00000000024d1490 *

Create a two channels blob for dnn::Net

int sz[] = { 1, 2, 128, 128}; cv::Mat blob = Mat(4, sz, CV_32F);

cv::Mat img1 = cv::imread("left_img.jpg", IMREAD_GRAYSCALE); cv::Mat img2 = cv::imread("right_img.jpg", IMREAD_GRAYSCALE); img1.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 0)))); img2.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 1)))); net.setInput(blob, "input"); //set the network input Mat result = net.forward(); //compute output

However, this give me error

tensorflow_model_loader': malloc():

malloc(): smallbin double linked list corrupted: 0x00000000024d1490 ***

What is the correct way of passing two channels blob into dnn::Net?

smallbin double linked list corrupted: 0x00000000024d1490 *

Create a two channels blob for dnn::Net

I want to pass 2 dimension channels into the dnn::Net, but blobFromImage do not support it, so I try to do it by myself

int sz[] = { 1, 2, 128, 128};
cv::Mat blob = Mat(4, sz, CV_32F);

CV_32F);

cv::Mat img1 = cv::imread("left_img.jpg", IMREAD_GRAYSCALE); cv::Mat img2 = cv::imread("right_img.jpg", IMREAD_GRAYSCALE); img1.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 0)))); img2.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 1)))); net.setInput(blob, "input"); //set the network input Mat result = net.forward(); //compute output

output

However, this give me error

tensorflow_model_loader': malloc(): smallbin double linked list corrupted: 0x00000000024d1490 ***

What is the correct way of passing two channels blob into dnn::Net?

click to hide/show revision 4
retagged

updated 2017-10-01 03:06:24 -0600

berak gravatar image

Create a two channels blob for dnn::Net

I want to pass 2 dimension channels into the dnn::Net, but blobFromImage do not support it, so I try to do it by myself

int sz[] = { 1, 2, 128, 128};
cv::Mat blob = Mat(4, sz, CV_32F);

cv::Mat img1 = cv::imread("left_img.jpg", IMREAD_GRAYSCALE);
cv::Mat img2 = cv::imread("right_img.jpg", IMREAD_GRAYSCALE);
img1.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 0))));
img2.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 1))));
net.setInput(blob, "input"); //set the network input
Mat result = net.forward(); //compute output

However, this give me error

tensorflow_model_loader': malloc(): smallbin double linked list corrupted: 0x00000000024d1490 ***

What is the correct way of passing two channels blob into dnn::Net?

Create a two channels blob for dnn::Net

I want to pass 2 dimension channels into the dnn::Net, but blobFromImage do not support it, so I try to do it by myself

int sz[] = { 1, 2, 128, 128};
cv::Mat blob = Mat(4, sz, CV_32F);

cv::Mat img1 = cv::imread("left_img.jpg", IMREAD_GRAYSCALE);
cv::Mat img2 = cv::imread("right_img.jpg", IMREAD_GRAYSCALE);
img1.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 0))));
img2.copyTo(Mat(img.rows, img.cols, CV_32F, blob.ptr((0, 1))));
net.setInput(blob, "input"); //set the network input
Mat result = net.forward(); //compute output

However, this give me error

tensorflow_model_loader': malloc(): smallbin double linked list corrupted: 0x00000000024d1490 ***

What is the correct way of passing two channels blob into dnn::Net?

Edit :

Two bugs, 1 of them pointed out by berak(thanks), another is due to the extra "()", should change blob.ptr((0, 0)) to blob.ptr(0, 0)