# Understanding Region of Interest selection in a Camera

I want to understand how ROI selection actually happens inside a camera? I have an ethernet camera, that can capture and send images to the PC, based on user defined ROI. The advantage of this is that I transfer only useful/relevant data from the image to my PC which will process it, instead of processing on the complete image.

The manufacturer has given a user guide, that gives very little details. The user guide says that ROI Selection-1(see figure below) is a valid ROI, and the ROI Selection-2 is of no use, in the sense that it will be still sending the complete image (though with some 0 values or garbage). That is the ROI selection-2 will not give any advantage of having only useful data transfer.

In support of his arguments he has given the following figure(without any explanation)

Horizontal scanning

Vertical scanning

Can someone help me understand why the selection 2 is invalid. I am really facing problem in understanding these pulses. Is there any link giving details about these pulses?

-

Here's what I think is going on.

In the example above, with the "A", let's assume that all white space takes up very little information in the data stream when being transferred from the camera, and that the "A" itself takes considerably more space (similar to how, in a JPEG, an image with lots of solid color will be smaller than an image with lots of contrast). In this case, looking at ROI 1, you are cutting out parts of the "A", meaning parts of the image that would be costly to transfer are being left out. This means that the resulting stream will be considerably smaller. In ROI 2, the only parts being cut out are white parts that would be very cheap to transfer anyway, thus making it inefficient.

Looking at the two diagrams, the first one seems to illustrate RIO 1. Notice that the video output here seems to measure 2,448 CLK. In the upper right we see that 1 CLK = 12.22 nanoseconds. Doing the math, that comes out to the video output taking 29.91456 microseconds. Meanwhile, in the second diagram, we have what appears to be an illustration of RIO 2. Here, video output is measured at 2,058 H, with 1 H being 31.68 microseconds. That comes out to 65.19744 milliseconds, considerable longer than 30 microseconds.

I'll admit the diagrams are strange, but really they just seem to be an overly-complicated way of saying that RIO 1 leaves less hard-to-transfer parts of the image than RIO 2 (which leaves all of it).

That's my guess.

-

The image is scanned (and data stored) with an imaginary cursor starting at the upper left, working across horizontally to the right, then the cursor pauses to move down one line and resetting to left edge. One could think of the rectangular image as a single string where the "carriage return - line feed" is merely implied by keeping track of the timing (or counting pixels). In most image storage formats, the width and height are tags in the header and the data itself is a long stream without demarcated frame extents. Since the figures speak about clocks and blanking however, file storage is probably not implicated here.

I think that the horizontal scan lines can be skipped (or at least started and then reset arbitrarily), but cannot be started at an arbitrary distance from the left edge.

Selection 1, is optimal for this behavior: you send a minimal set of commands to skip down to the proper horizontal position, and scanning can start at the upper left of the desired viewport scan what is desired and then skip the rest.

In Selection 2, we must scan every single line to at least the rightward extent of the part we are interested in, at which time we can send a command to move to the next line and reset.

Very roughly: if you have a 99w x 99h "units", and are interested in 1/3 of the image centered as in the examples, in selection 1, you scan 99w x 33h units while in selection 2, you must scan 66w x 99h units minimum. It is unclear to me, but the supporting figure looks to me to be speaking about selection 2 only, and the horizontal "2,592clk 1H" implies to me that the right-side mask is skipped for scanning.

Note that if the camera cannot start a horizontal line without scanning the complete line (i.e. can't stop and reset at an arbitrary distance from the left edge), then the selection 2 scenario must scan 99w x 99h units.

-