0

I have a function which calculates image texture (using 2D convolution via NLFILTER):

y=imagetexture(image,winsize)

In my matlab workspace I have 3 variables; the red green and blue bands of an image (r,g,b).
How can I repeatedly run this function on each band (r,g,b) for various window sizes?
e.g. 3x3,5x5,7x7 etc.

Thanks

1 Answer 1

2

If your red, green and blue image bands were stored in variables r, g, and b, would this do what you need?

winsizes = [3, 5, 7];

for i = 1:numel(winsizes)
    yr{i} = imagetexture(r, winsizes(i));
    yg{i} = imagetexture(g, winsizes(i));
    yb{i} = imagetexture(b, winsizes(i));
end
Sign up to request clarification or add additional context in comments.

2 Comments

Yes that's worked, thanks! Just one more thing; How do I get the individual layers out of the cell variable it creates?
If you've run the code above, then to put the results for the red band with window size 3 into its own array, you could say something like red3 = yr{1}.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.