image quadrant one by one and move to next quadrant
Show older comments
Hello, I want to show mask one quadrant by one quadrant and take images. But the code is making on one quadrant and the two and three...Eventually all the quadrants are on. After comparing the intensities of the image, I want to move to that quadrant and divide it again by four, such as in images pdf attached. Can anyone please help me with this?
% function dimension = getquadrant(q1,q2,q3,q4)
clc
clear all
close all
%%load dmd
classname = 'alpV42x64';
tagname = classname;
pseudoDLL = logical(0);
protofile = 'alpV42x64proto.m';
protofunc = @alpV42x64proto;
arch = 'win64';
dllfile = 'C:\Users\ReddyLabAdmin\Documents\MATLAB\alp4395.dll';
alplib('delete')
alplib('set', 'tag', tagname, 'classname', classname, ...
'dllfile', dllfile, 'pseudoDLL', pseudoDLL, 'protofile', protofile, ...
'protofunc', protofunc, 'arch', arch)
myapi = alpload();
mydev = alpdevice(myapi);
mydev.alloc();
%define the size of dmd
i = 1024;
j = 768;
dmd = zeros(i,j,'uint8');
[rows, columns, numColorChannels] = size(dmd)
numblocks = 2;
topRows = round(linspace(1, rows+1, numblocks + 1))
leftColumns = round(linspace(1, columns+1, numblocks + 1))
%show mask and capture image
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;
dmd(row1 : row2, col1 : col2, :) = 255;
mydev.put(dmd);
myimage1 = captureimage();
%imwrite(myimage1,'r_row%d%dcolumn%d%d.jpg,row1, row2, col1, col2');
mydev.stop();
end
end
% %q1
% dmd = zeros(i,j,'uint8');
% q1 = 1:j/2,1:i/2;
% dmd(q1) = 255;
% mydev.put(dmd);
% myimage1 = captureimage();
% imwrite(myimage1,'Q1.jpg');
% mydev.stop();
% %q2
% dmd = zeros(i,j,'uint8');
% q2 = j/2:j,1:i/2;
% dmd(q2) = 255;
% mydev.put(dmd);
% myimage2 = captureimage();
% imwrite(myimage2,'Q2.jpg');
% mydev.stop();
% %q3
% dmd = zeros(i,j,'uint8');
% q3 = 1:j/2,i/2:i;
% dmd(q3) = 255;
% mydev.put(dmd);
% myimage3 = captureimage();
% imwrite(myimage3,'Q3.jpg');
% mydev.stop();
% %q4
% dmd = zeros(i,j,'uint8');
% q4 = j/2:j,i/2:i;
% dmd(q4) = 255;
% mydev.put(dmd);
% myimage4 = captureimage();
% imwrite(myimage4,'Q4.jpg');
% mydev.stop();
maximumintensity = calculatemaximum(myimage1,myimage2,myimage3,myimage4);
% if maximumintensity == meanIntensityValue1
% dimension = size(q1);
% else if maximumintensity == meanIntensityValue2
% dimension = size(q2);
%
% else if maximumintensity == meanIntensityValue3
% dimension = size(q3);
%
% else maximumintensity == meanIntensityValue4
% dimension = size(q4);
% end
Accepted Answer
More Answers (0)
Categories
Find more on Region and Image Properties in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!