Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

OpenCV IplImage picture structure

Shulou Source: shulou.com Published: 2022-06-03 01:39:31 09月24日 Update

Preface

Most of the corresponding operation functions of IplImage in version 4.0 are obsolete, such as cvCreateImage, so if you need to use it, you can pass the test on version 3.0.

At present, we take the example of docking Rainbow soft SDK as an example to illustrate.

/ / crop the picture

Void CutIplImage (IplImage* src, IplImage* dst, int x, int y)

{

CvSize size = cvSize (dst- > width, dst- > height); / / region size

CvSetImageROI (src, cvRect (x, y, size.width, size.height)); / / set the source image ROI

CvCopy (src, dst); / / copy the image

CvResetImageROI (src); / / clear the ROI after the source image is used up

}

IplImage* img1 = cvLoadImage ("FRU IplImage* img1 2-123.jpg")

IplImage* cutImg1 = cvCreateImage (img1- > width-img1- > width% 4, img1- > height), IPL_DEPTH_8U, img1- > nChannels)

CutIplImage (img1, cutImg1, 0,0)

ASVLOFFSCREEN offscreen1 = {0}

Offscreen1.u32PixelArrayFormat = ASVL_PAF_RGB24_B8G8R8

Offscreen1.i32Width = cutImg1- > width

Offscreen1.i32Height = cutImg1- > height

Offscreen1.pi32Pitch [0] = cutImg1- > widthStep

Offscreen1.ppu8Plane [0] = (MUInt8*) cutImg1- > imageData

Res = ASFDetectFacesEx (handle, & offscreen1, & detectedFaces1)

Tags: Example version source image picture function preface area image size test structure Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Linux OPPO Reno Huawei Redmi