Ask Your Question
0

Simple matrix operation not working : is it normal ?

asked 2014-11-23 04:42:51 -0600

huehuehue gravatar image

If I write for example image=255*image, the value of image is not updated (I should get a full white image). Is this normal ? Do I have to go through inner loops to multiply each element ?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-11-24 03:00:39 -0600

What is the datatype of your matrix? (If you want it to be white, a image.setTo(255) for an CV_8UC1-image does the job)

Have you maybe passed your image by value instead of reference?

edit flag offensive delete link more

Comments

the image come from image = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE); So it should be CV_8UC1. I don't want the image to be white, it was just for testing the multiplication. What do you mean by passing by value instead of reference ? Normally it should be automatically be passed by reference, no ?

huehuehue gravatar imagehuehuehue ( 2014-11-27 06:48:00 -0600 )edit

Sorry I found the error. It was very stupid. My image is binary so a multiplication by 255 doesn't change anything (blacks pixels are 0's so remain black). I don't have an issue anymore.

huehuehue gravatar imagehuehuehue ( 2014-11-27 06:50:39 -0600 )edit
0

answered 2014-11-23 12:10:19 -0600

Hi!

there is probably something wrong with your code, because this works for me... Can you post the code you use?

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-23 04:42:51 -0600

Seen: 142 times

Last updated: Nov 24 '14