Image analysis, intensity within a rectangle area
12 ビュー (過去 30 日間)
古いコメントを表示
Hi, I was wondering if someone can help me. I have a gray image of certain size (say 400 x 400 pixels) in which I have some intensity distribution.
I would like to find the maximal intensity within a rectangle area within the image. The rectangle area is variable, but let's say for simplification I would like to start to investigate a rectangle of the size 16*16 pixels. Later I want to increase the rectangle area to another size and repeat the process.
I would like to sweep this rectangle over my image to find the maximal intensity area (sum(sum(image(rectArea))) and the location to be able to mark the location this on the image (mostly to check I am not totally off). Any idea how to do this?
I started something but I am not getting anywhere:
close all
clear all
clc
format shortEng
format compact
imf='image.jpg';
grayImage = imread(imf);
hold on
%imshow(grayImage, []);
%image(grayImage)
%title('Original Grayscale Image');
%set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
allintensityValue = sum(sum(grayImage))
retina_pixel_FOV = 0.1; % mrad / pixel
imshow(grayImage,[]);
hold on;
%improfile
[col,row] = find(grayImage == max(max(grayImage)))
plot(row,col,'+r')
small_rect = round(1.5/retina_pixel_FOV/2)
large_rect = round(5/retina_pixel_FOV/2)
pos1 = row-small_rect % i
pos2 = row+small_rect
pos3 = col-small_rect % j
pos4 = col+small_rect
plot(pos1,pos3,'+m'); plot(pos1,pos4,'+m')
plot(pos2,pos4,'+m'); plot(pos2,pos3,'+m')
[rowp,colp]=size(grayImage);
mask = zeros(rowp,colp); size(mask)
for i=1:rowp
for j=1:colp
if j == pos1:1:pos2
mask(i,j) = 1;
end
if i == pos3:1:pos4
mask(i,j) =1;
end
end
end
plot(mask.*grayImage')
??
Attached an image example.
0 件のコメント
回答 (1 件)
Ankitha Kollegal Arjun
2017 年 4 月 19 日
編集済み: Ankitha Kollegal Arjun
2017 年 4 月 19 日
Hello Lizan,
There are two functions in MATLAB that can help in obtaining different properties of an image or a specific region in an image: they are the "imagemodel" and "regionprops" functions.
The "getMinIntensity" and "getMaxIntensity" properties of the IMAGEMODEL class return the minimum and maximum intensity information.
Similarly, "MaxIntensity" and "MinIntensity" properties return the intensity information for a specific region in an image.
The following documentation contains more information about the two functions mentioned above:
--
Thanks,
Ankitha
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!