how to create a block of 5x5 pixel in image

asked 2014-10-20 07:10:55 -0500

Deepak Kumar gravatar image

Hi, i have to select a 5X5 block of pixel in a mat image. How can i create of window of 5X5 block.

edit retag flag offensive close merge delete

Comments

By using a region of interest. More info on this can be found here. Scroll a bit down and start reading :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-20 07:18:56 -0500 )edit

I dont want to create matrix. i m already having a mat image, i want to select its 5x5 pixel from origin. and then want to find local standard deviation of it. like stdfilt() function

Deepak Kumar gravatar imageDeepak Kumar ( 2014-10-20 07:23:45 -0500 )edit
4

Well then again, if you had read correctly you could see that there is a region of interest parameter that you can use. Basically what you then do is:

 Mat existing_image = ... ; //defined by you
 Mat local_region = existing_image( Rect(x,y,w,h) ); //adjust parameters to your needs - creates an extra header only, not a deep clone, so it is the same data!
 applyfunction(local_region);

That will do the trick for you...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-20 07:39:57 -0500 )edit