Ask Your Question
1

modifying pixel value

asked 2013-04-26 17:08:42 -0500

hayden gravatar image

Hello every body, after loading picture, i would like to modify the pixel values and write it back i.e. the modified image. Could any one give me some hint how can that be done. Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-04-26 22:04:57 -0500

wuling gravatar image

updated 2013-04-27 01:47:15 -0500

Hi,I use Mat format. If you have a gray picture & change a pixel. like:

 image.at<uchar>(i,j)=valve// where i is image row & j is image cols & 0<=value<=255

if you want to change all picture value:

for(int y = 0; y < image.row; y++)
    for(int x = 0 < image.col; x++)
    {
       ..............
        imageB.at<uchar>(y,x)=saturate_cast<uchar>(operator(image.at<uchar>(y,x)))
         //where operator is image processing algorithm
       ............
    }

& please ref Mat::isContinuous and other Mat operator :http://docs.opencv.org/modules/core/doc/basic_structures.html

If you want lower cost time. I think you should ref opencv code:SSE & AVX or CUDA

edit flag offensive delete link more

Comments

how can i modify pixel value from 0 to 0.01 ?

Deepak Kumar gravatar imageDeepak Kumar ( 2014-11-14 05:48:03 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-04-26 17:08:42 -0500

Seen: 11,243 times

Last updated: Apr 27 '13