Image Processing Detrend Error

2 views (last 30 days)
E. Skaggs
E. Skaggs on 2 Oct 2020
Edited: E. Skaggs on 3 Oct 2020
I'm a graduate student with very little Matlab background before this project. I'm attempting to use a river detection code given to me to highlight fluvial features in SAR images of Titan. The code has only been used for SAR features on Earth and the sample image they gave me works with the code with no issues. The errors come when I try to use my data.
Without modifying the image I get the error: Array dimensions must match for binary array op. (Error in Detrend.m) D = M-(aX + bY + c);
My image is an 8-bit unsigned integer while their image is a 32-bit floating point. Their image is also much smaller than mine (8,000kb vs 25,000kb).
I tried cropping the image because there's a lot of empty, black space not needed. That resulted in the image going from grayscale (required for code) to RGB (not compatible), and codes such as:
[rows, columns, numberOfColorChannels] = size(image);
if numberOfColorChannels > 1
image = image(:, :, 2);
end
and
image= image(:,:,1:3);
image= rgb2gray(image);
were not working to convert the image and the colortype was still 'treucolor'.
Code from https://www.mathworks.com/matlabcentral/answers/93196-how-do-i-convert-a-24-bit-depth-image-file-to-an-8-bit-depth-image-file :
[Ximage,mapimage] = imread(image);
XimageRGB = ind2rgb(Xtrees,maptrees);
XtreesRGB = im2uint8(XtreesRGB);
gave me the error:
Error using matlab.images.internal.iptcheckmap (line 50)
Function IND2GRAY expected input number 2, MAP, to be a valid colormap. Valid colormaps must be nonempty, double, 2-D matrices with 3 columns.
(I have not tried to troubleshoot that yet).
The river detection code requires TIFF format, grayscale, and GeoTAGs from the trial and error I've done so far. The modifications I've done to the image always go back to the Detrend error saying array dimensions must match for binary array op. I've been trying to get my image similar to the successful test image they supplied, but I'm not sure if that's possible.
I would appreciate any suggestions to try. Unfortunately I do not have permission to share the detection code as I did not write it, but I tried to include codes I've tried implementing. I've been trying to use other answers and the mathworks page to understand functions, but there's a lot I do not understand still.

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!