How can I get the set of original pixels used to calculate the pixels of a downscaled image?

조회 수: 1 (최근 30일)
Hello I have a grayscale image of parts that is 1872 X 2624 that I am downscaling to 32 X 31, to match other temperature data of the same size. I have found the centroids and extrema at the large resolution and want to know what pixels they were used to calculate on the downscaled image. I would like to be able to get a list (or other format) of pixels used so the final result would be a cell array or structure where each field/element contained a double with the indicies (linear or element wise) from the larger image. Is this possible?
My ultimate goal is to be able to use this information to extract temperature data relative to each part. I have attached examples of the higher resolution image(layer00493_thumbnail), a plot showing the extracted centroids & extrema and each part (Layer 493 Plot), my current luck with different downscaling methods(Layer 493 Downscaled), & an example of a plot of the temperature data (Layer 493 Sensor Data).
Thanks for the help!
  댓글 수: 2
Image Analyst
Image Analyst 2020년 5월 31일
Can't you just multiply the coordinates gotten from your small image by 1872/32, or by 2624/31 to get the location in the larger image?
HarleyR
HarleyR 2020년 5월 31일
편집: HarleyR 2020년 6월 1일
I can(see below image) but I was under the impression that downscaling used a number of pixels from the original image and then did some operations (dependent on downscaling method) to arrive at at value. As far as I know getting the coordinates in the larger image(like suggested) does not tell me the number&coordinates of surrounding pixels involved in determining the new values in the smaller image? I am still a little unclear on the downscaling process, and have been reading what I can find on the different methods so please correct me if this is not accurate. Also as you can see in the image it appears to just get the right corner of the pixel and not the center as well, this could be an issue with my code so I added it to make sure that was not the case.
fp='Your file path'
Original_img=imread(fp);
Invert_original=imcomplement(Original_img);
Invert_fill_original = imfill(Invert_original, 'holes');
CC=bwconncomp(Invert_fill_original);
measurements=regionprops(CC,'Centroid','Extrema','MajorAxisLength','MinorAxisLength','PixelIdxList','SubarrayIdx', 'Orientation');
centroids=cat(1,measurements.Centroid);
extrema=cat(1,measurements.Extrema);
nrows=32;
ncols=31;
i=1;
for y=1:nrows%Note Ycord corresponds to row
for x=1:ncols%Note Xcord corresponds to col
ycord_large=y*(1872/32);
xcord_large=x*(2624/31);
row_col_cord(i,1)=ycord_large;
row_col_cord(i,2)=xcord_large;
i=i+1;
end
end
imshow(Invert_fill_original)
hold(imgca,'on')
plot(imgca,row_col_cord(:,2), row_col_cord(:,1), 'r*')
plot(imgca,centroids(:,1), centroids(:,2), 'g*')
plot(imgca,extrema(:,1), extrema(:,2), 'g*')

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by