Ask Your Question
0

Display grayscale image in picturebox

asked 2016-03-30 07:51:56 -0600

Nbb gravatar image

Hi,

I am trying to display a grayscale image in a visual studio C++ picture box. I followed the code below yet it says the mixChannels argument are not correct. What is &amp ?

Mat gray_3channels(gray.rows, gray.cols, CV_8UC3);
 Mat in[] = { gray, gray, gray };
 int from_to[] = { 0,0, 1,1, 2,2 };
 mixChannels( in, 3, &gray_3channels, 1, from_to, 3 );

http://answers.opencv.org/question/16...

But if anyone knows how else i can easily display grayscale image in a picture box please do tell me. Thanks

edit retag flag offensive close merge delete

Comments

&amp = & (different encoding/escape format)

LorenaGdL gravatar imageLorenaGdL ( 2016-03-30 09:14:57 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-03-31 04:22:54 -0600

updated 2016-03-31 06:05:06 -0600

You achieved the &amp by copy pasting from a webpage. Simply replace the & part with a & and your code will work perfectly fine...

The reason why the & is actually there is to ensure that your are writing to the correct shared data instance, instead of just passing the pointer around!

edit flag offensive delete link more

Comments

2

In fact he got the &amp from your comment in the linked question ;P

LorenaGdL gravatar imageLorenaGdL ( 2016-03-31 04:34:45 -0600 )edit
2

^^ there must have been a bug in the previous forum software. edited the original comment, and problem is gone.

berak gravatar imageberak ( 2016-03-31 04:52:10 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-03-30 07:51:56 -0600

Seen: 448 times

Last updated: Mar 31 '16