Search code examples
matlabfigurecontrast

MATLAB:imcontrast for subplot


I want to use imcontrast for several images in one figure which is drawed by subplot. There is similar question but it wasn't answered:

https://www.mathworks.com/matlabcentral/answers/160315-how-to-adjust-contrast-of-a-figure-with-3-subplots-simultaneously

In the answer of this question, he suggested usage of imadjust. It is not proper for my case because I'm opening saved fig files. Is there any way for my case like the question asked?


Solution

  • To do this, you need to call imcontrast(h) for each subplot. Once the figure is open, h1 = subplot(1,2,1); imcontrast(h1); allowed me to edit the first subplot.

    I tested using the following code:

    subplot(1,2,1); imshow('coins.png');
    subplot(1,2,2); imshow('coins.png');
    h1 = subplot(1,2,1); 
    imcontrast(h1);