Home  >  Article  >  Computer Tutorials  >  How to embed images in a program written in C language

How to embed images in a program written in C language

WBOY
WBOYforward
2024-01-25 14:39:051349browse

How to embed images in a program written in C language

How to insert pictures into the program written in C language

Try OpenCV, an open source image processing function library based on C/C language:

#include "cv.h"

#include "highgui.h"

int main( int argc, char** argv )

{

IplImage* pImg; //Declare IplImage pointer

//Load image

if( argc == 2 &

(pImg = cvLoadImage( argv[1], 1)) != 0 )

{

cvNamedWindow("Image", 1); //Create window

cvShowImage("Image", pImg); //Display image

cvWaitKey(0); //Wait for key

cvDestroyWindow("Image");//Destroy the window

cvReleaseImage( &pImg ); //Release image

return 0;

}

How to insert jpg into DWG file

Import JPG pictures into CAD:

1. Copy and paste the image directly.

2. Use the following command:

imageattach Enter.

Find the path and picture, specify the reference point position when importing (the lower left corner of the picture is the default), specify the scale, and press Enter.

Tips: ACAD is a vector drawing software, and the jpg format is a bitmap. You cannot directly use ACAD to edit the contents of the drawing.

3. Just "Insert" - "OLE Object" - "Picture".

4. There are two methods to convert pictures to CAD format:

A. Use Adobe's Streamline software to directly convert pixel bitmaps into AI line files, then use Illustrator software to open the AI ​​files and convert them into DXF or DWG files.

B. Directly use Illustrator software to open the pixel bitmap, the steps are as follows:

aOpen the picture with Illustrator software.

bPress the "V" shortcut key to start the selection function; then select the picture.

cClick on the small triangle next to "Real-time Scan" in the property bar under the menu bar at the top of the desktop, and select "Detailed Illustrations" among the options.

dClick the "Extend" button in the property bar. At this time, the edge between the two colors in the picture will be converted into a line.

eSelect the "Export" option under the "File" menu, and then select the type of export file as "DWG" or "DXF"; then select "Save", the "DWG/DXF Options' dialog box will pop up, select You can ignore the CAD version, color number, raster file format, etc. and just select "OK".

f Enter CAD to modify the lines.

The above is the detailed content of How to embed images in a program written in C language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete