2

I have an image in PIX format, and I have a BOX[with the necessary coordinates] too, I would like to draw a border around the content that's in the box, like for example -
example

I've looked around in the documentation, but so far I've only found out how to border the whole image, not just a rectangle inside it.

M. Ivanov
  • 283
  • 1
  • 2
  • 13
  • I know how do it by using pixSetPixel, but that's kinda slow, plus I am thinking that there must be a function inside the lib. For now I will use my own function: `void SetBorder(PIX* img,BOX *b) { for(int i=0; i< b->w;i++) { pixSetRGBPixel(img,b->x+i,b->y,255,255,255); pixSetRGBPixel(img,b->x+i,b->y+b->h,255,255,255); } for(int i=0; i< b->h;i++) { pixSetRGBPixel(img,b->x,b->y+i,255,255,255); pixSetRGBPixel(img,b->x+b->w,b->y+i,255,255,255); } }` – M. Ivanov Mar 30 '13 at 23:09

1 Answers1

1

Your method works only for images depth of 3 bpp. Use the pixPaintBoxa or pixDrawBoxa method. See https://tpgit.github.io/Leptonica/boxfunc3_8c.html#a2dca217227f62a99f6003910420b47ba for more details. These methods work for any bpp.

However to use these functions, you have to build leptonica again using static makefiles. See http://www.leptonica.com/source/README.html#DEVELOP for more details.