I have an satellite image and I want to extract the information from ROI of image?

조회 수: 2 (최근 30일)
I have an satellite image and I want to extract the information from the red portion of the image. How can I obtain the information from the red portion of the image?
I have attached the image and the portion of image from where I want to extract the information

채택된 답변

Kevin Holly
Kevin Holly 2023년 1월 9일
Note, I used Computer Vision Toolbox below.
Capture_img = imread('Capture.jpg');
Picture1_img = imread('Picture1.png');
imshow(Capture_img)
imshow(Picture1_img)
size(Picture1_img)
ans = 1×3
677 692 3
size(Capture_img)
ans = 1×3
627 663 3
Using the Registration Estimator app to make sure images are co-registered:
[NewPicture1_img] = registerImages(Picture1_img,Capture_img)
NewPicture1_img = struct with fields:
FixedMatchedFeatures: [220×1 SURFPoints] MovingMatchedFeatures: [220×1 SURFPoints] Transformation: [1×1 projective2d] RegisteredImage: [627×663×3 uint8] SpatialRefObj: [1×1 imref2d]
imshow(NewPicture1_img.RegisteredImage)
Picture1_img=NewPicture1_img.RegisteredImage;
imshow(Picture1_img(:,:,1))
imshow(Picture1_img(:,:,1)>225&Picture1_img(:,:,2)==0)% When red slice intensity values are greater than 225 and green slice intensity values are equal to 0.
% Convert logical matrix into 8-bit image then multiply by Capture_img
imshow(Capture_img.*uint8(Picture1_img(:,:,1)>225&Picture1_img(:,:,2)==0))
function [MOVINGREG] = registerImages(MOVING,FIXED)
%registerImages Register grayscale images using auto-generated code from Registration Estimator app.
% [MOVINGREG] = registerImages(MOVING,FIXED) Register grayscale images
% MOVING and FIXED using auto-generated code from the Registration
% Estimator app. The values for all registration parameters were set
% interactively in the app and result in the registered image stored in the
% structure array MOVINGREG.
% Auto-generated by registrationEstimator app on 09-Jan-2023
%-----------------------------------------------------------
% Feature-based techniques require license to Computer Vision Toolbox
checkLicense()
% Convert RGB images to grayscale
FIXED = im2gray(FIXED);
MOVINGRGB = MOVING;
MOVING = im2gray(MOVING);
% Default spatial referencing objects
fixedRefObj = imref2d(size(FIXED));
movingRefObj = imref2d(size(MOVING));
% Detect SURF features
fixedPoints = detectSURFFeatures(FIXED,'MetricThreshold',750.000000,'NumOctaves',3,'NumScaleLevels',5);
movingPoints = detectSURFFeatures(MOVING,'MetricThreshold',750.000000,'NumOctaves',3,'NumScaleLevels',5);
% Extract features
[fixedFeatures,fixedValidPoints] = extractFeatures(FIXED,fixedPoints,'Upright',false);
[movingFeatures,movingValidPoints] = extractFeatures(MOVING,movingPoints,'Upright',false);
% Match features
indexPairs = matchFeatures(fixedFeatures,movingFeatures,'MatchThreshold',50.000000,'MaxRatio',0.500000);
fixedMatchedPoints = fixedValidPoints(indexPairs(:,1));
movingMatchedPoints = movingValidPoints(indexPairs(:,2));
MOVINGREG.FixedMatchedFeatures = fixedMatchedPoints;
MOVINGREG.MovingMatchedFeatures = movingMatchedPoints;
% Apply transformation - Results may not be identical between runs because of the randomized nature of the algorithm
tform = estimateGeometricTransform2D(movingMatchedPoints,fixedMatchedPoints,'projective');
MOVINGREG.Transformation = tform;
MOVINGREG.RegisteredImage = imwarp(MOVINGRGB, movingRefObj, tform, 'OutputView', fixedRefObj, 'SmoothEdges', true);
% Store spatial referencing object
MOVINGREG.SpatialRefObj = fixedRefObj;
end
function checkLicense()
% Check for license to Computer Vision Toolbox
CVTStatus = license('test','Video_and_Image_Blockset');
if ~CVTStatus
error(message('images:imageRegistration:CVTRequired'));
end
end
  댓글 수: 1
Kevin Holly
Kevin Holly 2023년 1월 9일
If you want the size (e.g. pixel area, major axis length) or other properties of the ROI, you can use regionprops on the binary image, where the ROI has a value of one and all other pixels have a value of zero.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by