Community
cancel
Showing results for 
Search instead for 
Did you mean: 
fg_victormail_ru
Beginner
66 Views

How cut borders from image

Hi, I have such problem, I have image and there are some white stripes around it and I don't know how get only image without this borders. This stripes can have different size and I have a lot of images where this stripes are present.Hi, I have such problem, I have image and there are some white stripes around it and I don't know how get only image without this borders. This stripes can have different size and I have a lot of images where this stripes are present.

PS Sorry for my English

0 Kudos
2 Replies
pvonkaenel
New Contributor III
66 Views

Hi, I have such problem, I have image and there are some white stripes around it and I don't know how get only image without this borders. This stripes can have different size and I have a lot of images where this stripes are present.Hi, I have such problem, I have image and there are some white stripes around it and I don't know how get only image without this borders. This stripes can have different size and I have a lot of images where this stripes are present.

PS Sorry for my English


If you want to process a region-of-interest of an image, you need to offset the starting pointer by the number of lines and columns of the border region, reduce the image width/height to the smaller size, and leave the step size of the original image along. Try something like the following:

[cpp]Ipp8u *pFullImg;  // Assume this points to first pixel of the bordered image
int wFull, hFull, sFull;  // Width, height, and step size of the bordered image
int borderRows, borderCols;  // This is the number of rows and columns in the border you want to cut out

Ipp8u *pRoiImg = pFullImg + (borderRows*sFull) + borderCols;  // Offset to ROI image you want to process
int wRoi = wFull - (2 * borderCols); // ROI width
int hRoi = hFull - (2 * borderRows); // ROI height

// Now use the IPP routines of interest using pRoiImg, wRoi, hRoi, and sFull.
// Note that it's important to use the origonal step size so that the IPP
// calls can get to the proper pixel in the next row




[/cpp]
fg_victormail_ru
Beginner
66 Views

Quoting - pvonkaenel
If you want to process a region-of-interest of an image, you need to offset the starting pointer by the number of lines and columns of the border region, reduce the image width/height to the smaller size, and leave the step size of the original image along. Try something like the following:

But I don't know border size it mast doing automatically. Is there are method like face detection but for images, like "image detection". The source image: The result must be:

000000

011110 1111

011110 1111

000000

where "0" is backgroud.

Reply