Home > Back-end >  How to use the BCB image cropping for elliptic give some ideas
How to use the BCB image cropping for elliptic give some ideas

Time:09-24

The younger brother doing recently BCB image cropping saved to the database, questions about tailoring, ask me algorithm implementation, how can do, have to be a teacher, really didn't

CodePudding user response:

Deal with this interest area is very simple with OpenCV

I am using VC + OpenCV image processing processing,

BCB can also use OpenCV, but want to convert the type library

Here is an example: http://blog.csdn.net/zht9961020/article/details/7036809

The demise of the CB cause some only VC version of the library

CodePudding user response:

Do a mask, black AND white ellipse, AND the target figure AND operation, save the result is ok,

CodePudding user response:

Int I, j, width, height;
TColor color;
TJPEGImage * j1=new TJPEGImage ();
J1 - & gt; The Assign (img1 - & gt; Picture - & gt; Graphic);

Bitmap Graphics: : TBitmap *=new Graphics: : TBitmap ();
TRect ARect;

Int nWidth, nHeight;
Float fy=float (j1 - & gt; Width)/img2 - & gt; Width;
Float fx=(float) j1 - & gt; Height/img2 - & gt; Height;
If (fy<=fx)
{
Bitmap - & gt; Width=(int) (j1 - & gt; Width/fx);
Bitmap - & gt; Height=img2 - & gt; Height;
ARect=the Rect (0, 0, Bitmap - & gt; Width, Bitmap - & gt; Height);
}

Bitmap - & gt; Canvas - & gt; StretchDraw (ARect, j1);
J1 - & gt; To Assign (Bitmap);
Img2 - & gt; Picture - & gt; Graphic=j1;


Width=img2 - & gt; Picture - & gt; Width;
Height=img2 - & gt; Picture - & gt; Height;
Int a=width/2, b=height/2;
for(i=0; I{
for(j=0; J{
Color=Bitmap - & gt; Canvas - & gt; Pixels [I] [j];
If (powl (I - a), (2)/powl (a, 2) + powl ((j - b), 2)/powl (b, 2) & lt;
=1)Img3 - & gt; Canvas - & gt; Pixels [I] [j]=color;
The else
Img3 - & gt; Canvas - & gt; [j]=0 XFFFFFF Pixels [I];
}
}

CodePudding user response:

Must first understand that all images are rectangular, ha ha, no ellipse,
Is ellipse, is displayed outside an elliptical area are pure color or transparent,

Specific ideas:
Is outside of the elliptical area filling, you can do a dual cycle, to determine whether a point outside the ellipse area in you, if is filled,
Ha ha, have done before, sent to you, realize yourself, remember well, understand thoroughly,

If the BCB, upstairs code should be able to reference,
  • Related