Comparing Image wih histogram

2 次查看(过去 30 天)
hi, I have a histgram, I want to travel through each patch of image and compare with histogram, if the patchsize is greater than threshold value make those pixel white else black. to get Patches I am using 'blockproc' I dont think whether Or not it could work for this situation.
fun = @(blk) std2(blk.data) * ones(size(blk.data));
imblk = blockproc(im, [patchsz patchsz], fun);
[m1 n1 nc] = size(imblk);
but I Think this would Also effect the Image Patches that is not needed, Just Want travel through Each patch in its original state, and if Image Pach Size > threshold(histogram) Set that Patch White else Black,
Regards

采纳的回答

Image Analyst
Image Analyst 2013-6-14
I don't understand what you're asking. Is the threshold going to change on a black-by-block basis? If not, simply do
binaryImage = grayImage > thresholdValue;
Next, your function is doing the standard deviation filter, which is done by stdfilt(), but it moves the window over a pixel at a time and not in "jumps" like blockproc does. This should give a smoother looking image while blockproc will give a blocky (bad) looking image.
  2 个评论
Muhammad Ali Qadar
Muhammad Ali Qadar 2013-6-14
Threshold is not going to Change, its selected in the histogram, we Compare Each block of Image With our Histogram, If 'PatchSize > ThresholdValue', My Question is Please Tell me the Way how can I iterate through Blocks/Patches of Image Mean I want get information about each patch, I have see many demos of You but in All those you are Dividing the Images, I want for loop that iterate over Each block and give information about each So that I could Compare that Block with Histogram, Looking for you Demo that implement this thing Also
Image Analyst
Image Analyst 2013-6-14
You can just do what I said:
binaryImage = grayImage > thresholdValue;
however it's not clear how those patches where the histogram is to be computed are chosen (they seem to imply it's by manually drawing the patches), and if the threshold computed from those patches is applied to the whole image, or just to those patches. Those questions would need to be answered before the solution is complete.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by