comicPanel - first column of each panel is 1 a multiple For...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function imarr = comicPanel(fn,numr,numc,row_num,col_num) %Consider an image file containing a comic strip. The comic strip is a %compilation of several panels put together to make a complete strip. %You may desire for some reason or another (a presentation, perhaps) to %extract just a single panel from the comic strip. %Write a function comicPanel that will do just that. Your function %should take in the filename of a comic, the number of rows and columns %in the comic, and the row and column that the desired panel is located %in. You should output an image array containing just the desired %panel. % Assume the following: %- The comic will be laid out in a grid. %- Each panel is an equal width that is determined by the total width % and the specified number of columns of panels. If this width is not % an integer, make it so with the floor() function. %- The last column of each panel is a multiple of the width, and the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % first column of each panel is 1 + a multiple. For example, if the % panel width is 50 pixels, columns 51 to 100 will hold the second % panel (or column of panels). %- The above is true for rows and heights. % Hint: % A two-by-two comic (such as xkcd.jpg) boils down to the well % documented four quadrant problem. If you are having trouble starting, % start with splitting an image into four quadrants, and then generalize % that code for any number of rows and columns. img = imread(fn); %reads in the file [r c clr] = size(img); %finds the size of the image panelrows = floor(r./numr); %determines the number of rows per panel panelcols = floor(c./numc); %determines the number of columns per panel imarr = img((row_num.*panelrows)-panelrows+1:row_num.*panelrows, (col_num.*panelcols)-panelcols+1:col_num.*panelcols,:); %indexes the correct row and column to start and end at end e...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Tech.

Ask a homework question - tutors are online