Split and image 128x138 into 16 subimages of 32x32 and create a new one using those subimages randomly
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Sergio José Uc Magaña
 el 3 de Mayo de 2022
  
    
    
    
    
    Comentada: Sergio José Uc Magaña
 el 4 de Mayo de 2022
            Take and CT image of 128x128 (previous resize) and split it into 16 subimages of 32x32, finally create a new "artificial CT" image using those subimages randomly. Captura shows CT and subimages from this CT, Captura2 shows a "artificial CT". I have this code for the first part:
% Read in image
grayImage = imread('pout.tif');
[rows, columns, numColorChannels] = size(grayImage)
imshow(grayImage);
axis on;
impixelinfo
numBandsVertically = 4;
numBandsHorizontally = 3;
topRows = round(linspace(1, rows+1, numBandsVertically + 1))
leftColumns = round(linspace(1, columns+1, numBandsHorizontally + 1))
% Extract into subimages and display on a new figure.
hFig2 = figure();
plotCounter = 1;
for row = 1 : length(topRows) - 1
    row1 = topRows(row);
    row2 = topRows(row + 1) - 1;
    for col = 1 : length(leftColumns) - 1
        col1 = leftColumns(col);
        col2 = leftColumns(col + 1) - 1;
        subplot(numBandsVertically, numBandsHorizontally, plotCounter);
        subImage = grayImage(row1 : row2, col1 : col2, :);
        imshow(subImage);
        caption = sprintf('Rows %d-%d, Columns %d-%d', row1, row2, col1, col2);
        title(caption);
        drawnow;
        plotCounter = plotCounter + 1;
    end
end
1 comentario
Respuesta aceptada
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



