mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
removed C API in the following modules: photo, video, imgcodecs, videoio (#13060)
* removed C API in the following modules: photo, video, imgcodecs, videoio * trying to fix various compile errors and warnings on Windows and Linux * continue to fix compile errors and warnings * continue to fix compile errors, warnings, as well as the test failures * trying to resolve compile warnings on Android * Update cap_dc1394_v2.cpp fix warning from the new GCC
This commit is contained in:
+21
-117
@@ -42,6 +42,9 @@
|
||||
#include "precomp.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
int validateToInt(size_t sz)
|
||||
{
|
||||
int valueInt = (int)sz;
|
||||
@@ -56,7 +59,7 @@ int validateToInt(size_t sz)
|
||||
|
||||
void icvCvt_BGR2Gray_8u_C3C1R( const uchar* rgb, int rgb_step,
|
||||
uchar* gray, int gray_step,
|
||||
CvSize size, int _swap_rb )
|
||||
Size size, int _swap_rb )
|
||||
{
|
||||
int i;
|
||||
int swap_rb = _swap_rb ? 2 : 0;
|
||||
@@ -75,7 +78,7 @@ void icvCvt_BGR2Gray_8u_C3C1R( const uchar* rgb, int rgb_step,
|
||||
|
||||
void icvCvt_BGRA2Gray_16u_CnC1R( const ushort* rgb, int rgb_step,
|
||||
ushort* gray, int gray_step,
|
||||
CvSize size, int ncn, int _swap_rb )
|
||||
Size size, int ncn, int _swap_rb )
|
||||
{
|
||||
int i;
|
||||
int swap_rb = _swap_rb ? 2 : 0;
|
||||
@@ -94,7 +97,7 @@ void icvCvt_BGRA2Gray_16u_CnC1R( const ushort* rgb, int rgb_step,
|
||||
|
||||
void icvCvt_BGRA2Gray_8u_C4C1R( const uchar* rgba, int rgba_step,
|
||||
uchar* gray, int gray_step,
|
||||
CvSize size, int _swap_rb )
|
||||
Size size, int _swap_rb )
|
||||
{
|
||||
int i;
|
||||
int swap_rb = _swap_rb ? 2 : 0;
|
||||
@@ -112,7 +115,7 @@ void icvCvt_BGRA2Gray_8u_C4C1R( const uchar* rgba, int rgba_step,
|
||||
|
||||
|
||||
void icvCvt_Gray2BGR_8u_C1C3R( const uchar* gray, int gray_step,
|
||||
uchar* bgr, int bgr_step, CvSize size )
|
||||
uchar* bgr, int bgr_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; gray += gray_step )
|
||||
@@ -127,7 +130,7 @@ void icvCvt_Gray2BGR_8u_C1C3R( const uchar* gray, int gray_step,
|
||||
|
||||
|
||||
void icvCvt_Gray2BGR_16u_C1C3R( const ushort* gray, int gray_step,
|
||||
ushort* bgr, int bgr_step, CvSize size )
|
||||
ushort* bgr, int bgr_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; gray += gray_step/sizeof(gray[0]) )
|
||||
@@ -143,7 +146,7 @@ void icvCvt_Gray2BGR_16u_C1C3R( const ushort* gray, int gray_step,
|
||||
|
||||
void icvCvt_BGRA2BGR_8u_C4C3R( const uchar* bgra, int bgra_step,
|
||||
uchar* bgr, int bgr_step,
|
||||
CvSize size, int _swap_rb )
|
||||
Size size, int _swap_rb )
|
||||
{
|
||||
int i;
|
||||
int swap_rb = _swap_rb ? 2 : 0;
|
||||
@@ -163,7 +166,7 @@ void icvCvt_BGRA2BGR_8u_C4C3R( const uchar* bgra, int bgra_step,
|
||||
|
||||
void icvCvt_BGRA2BGR_16u_C4C3R( const ushort* bgra, int bgra_step,
|
||||
ushort* bgr, int bgr_step,
|
||||
CvSize size, int _swap_rb )
|
||||
Size size, int _swap_rb )
|
||||
{
|
||||
int i;
|
||||
int swap_rb = _swap_rb ? 2 : 0;
|
||||
@@ -182,7 +185,7 @@ void icvCvt_BGRA2BGR_16u_C4C3R( const ushort* bgra, int bgra_step,
|
||||
|
||||
|
||||
void icvCvt_BGRA2RGBA_8u_C4R( const uchar* bgra, int bgra_step,
|
||||
uchar* rgba, int rgba_step, CvSize size )
|
||||
uchar* rgba, int rgba_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; )
|
||||
@@ -200,7 +203,7 @@ void icvCvt_BGRA2RGBA_8u_C4R( const uchar* bgra, int bgra_step,
|
||||
}
|
||||
|
||||
void icvCvt_BGRA2RGBA_16u_C4R( const ushort* bgra, int bgra_step,
|
||||
ushort* rgba, int rgba_step, CvSize size )
|
||||
ushort* rgba, int rgba_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; )
|
||||
@@ -220,7 +223,7 @@ void icvCvt_BGRA2RGBA_16u_C4R( const ushort* bgra, int bgra_step,
|
||||
|
||||
|
||||
void icvCvt_BGR2RGB_8u_C3R( const uchar* bgr, int bgr_step,
|
||||
uchar* rgb, int rgb_step, CvSize size )
|
||||
uchar* rgb, int rgb_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; )
|
||||
@@ -237,7 +240,7 @@ void icvCvt_BGR2RGB_8u_C3R( const uchar* bgr, int bgr_step,
|
||||
|
||||
|
||||
void icvCvt_BGR2RGB_16u_C3R( const ushort* bgr, int bgr_step,
|
||||
ushort* rgb, int rgb_step, CvSize size )
|
||||
ushort* rgb, int rgb_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; )
|
||||
@@ -256,7 +259,7 @@ void icvCvt_BGR2RGB_16u_C3R( const ushort* bgr, int bgr_step,
|
||||
typedef unsigned short ushort;
|
||||
|
||||
void icvCvt_BGR5552Gray_8u_C2C1R( const uchar* bgr555, int bgr555_step,
|
||||
uchar* gray, int gray_step, CvSize size )
|
||||
uchar* gray, int gray_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; gray += gray_step, bgr555 += bgr555_step )
|
||||
@@ -273,7 +276,7 @@ void icvCvt_BGR5552Gray_8u_C2C1R( const uchar* bgr555, int bgr555_step,
|
||||
|
||||
|
||||
void icvCvt_BGR5652Gray_8u_C2C1R( const uchar* bgr565, int bgr565_step,
|
||||
uchar* gray, int gray_step, CvSize size )
|
||||
uchar* gray, int gray_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; gray += gray_step, bgr565 += bgr565_step )
|
||||
@@ -290,7 +293,7 @@ void icvCvt_BGR5652Gray_8u_C2C1R( const uchar* bgr565, int bgr565_step,
|
||||
|
||||
|
||||
void icvCvt_BGR5552BGR_8u_C2C3R( const uchar* bgr555, int bgr555_step,
|
||||
uchar* bgr, int bgr_step, CvSize size )
|
||||
uchar* bgr, int bgr_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; bgr555 += bgr555_step )
|
||||
@@ -308,7 +311,7 @@ void icvCvt_BGR5552BGR_8u_C2C3R( const uchar* bgr555, int bgr555_step,
|
||||
|
||||
|
||||
void icvCvt_BGR5652BGR_8u_C2C3R( const uchar* bgr565, int bgr565_step,
|
||||
uchar* bgr, int bgr_step, CvSize size )
|
||||
uchar* bgr, int bgr_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; bgr565 += bgr565_step )
|
||||
@@ -326,7 +329,7 @@ void icvCvt_BGR5652BGR_8u_C2C3R( const uchar* bgr565, int bgr565_step,
|
||||
|
||||
|
||||
void icvCvt_CMYK2BGR_8u_C4C3R( const uchar* cmyk, int cmyk_step,
|
||||
uchar* bgr, int bgr_step, CvSize size )
|
||||
uchar* bgr, int bgr_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; )
|
||||
@@ -346,7 +349,7 @@ void icvCvt_CMYK2BGR_8u_C4C3R( const uchar* cmyk, int cmyk_step,
|
||||
|
||||
|
||||
void icvCvt_CMYK2Gray_8u_C4C1R( const uchar* cmyk, int cmyk_step,
|
||||
uchar* gray, int gray_step, CvSize size )
|
||||
uchar* gray, int gray_step, Size size )
|
||||
{
|
||||
int i;
|
||||
for( ; size.height--; )
|
||||
@@ -371,7 +374,7 @@ void CvtPaletteToGray( const PaletteEntry* palette, uchar* grayPalette, int entr
|
||||
int i;
|
||||
for( i = 0; i < entries; i++ )
|
||||
{
|
||||
icvCvt_BGR2Gray_8u_C3C1R( (uchar*)(palette + i), 0, grayPalette + i, 0, cvSize(1,1) );
|
||||
icvCvt_BGR2Gray_8u_C3C1R( (uchar*)(palette + i), 0, grayPalette + i, 0, Size(1,1) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,103 +601,4 @@ uchar* FillGrayRow1( uchar* data, uchar* indices, int len, uchar* palette )
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
CV_IMPL void
|
||||
cvConvertImage( const CvArr* srcarr, CvArr* dstarr, int flags )
|
||||
{
|
||||
CvMat* temp = 0;
|
||||
|
||||
CV_FUNCNAME( "cvConvertImage" );
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
CvMat srcstub, *src;
|
||||
CvMat dststub, *dst;
|
||||
int src_cn, dst_cn, swap_rb = flags & CV_CVTIMG_SWAP_RB;
|
||||
|
||||
CV_CALL( src = cvGetMat( srcarr, &srcstub ));
|
||||
CV_CALL( dst = cvGetMat( dstarr, &dststub ));
|
||||
|
||||
src_cn = CV_MAT_CN( src->type );
|
||||
dst_cn = CV_MAT_CN( dst->type );
|
||||
|
||||
if( src_cn != 1 && src_cn != 3 && src_cn != 4 )
|
||||
CV_ERROR( CV_BadNumChannels, "Source image must have 1, 3 or 4 channels" );
|
||||
|
||||
if( CV_MAT_DEPTH( dst->type ) != CV_8U )
|
||||
CV_ERROR( CV_BadDepth, "Destination image must be 8u" );
|
||||
|
||||
if( CV_MAT_CN(dst->type) != 1 && CV_MAT_CN(dst->type) != 3 )
|
||||
CV_ERROR( CV_BadNumChannels, "Destination image must have 1 or 3 channels" );
|
||||
|
||||
if( !CV_ARE_DEPTHS_EQ( src, dst ))
|
||||
{
|
||||
int src_depth = CV_MAT_DEPTH(src->type);
|
||||
double scale = src_depth <= CV_8S ? 1 : src_depth <= CV_32S ? 1./256 : 255;
|
||||
double shift = src_depth == CV_8S || src_depth == CV_16S ? 128 : 0;
|
||||
|
||||
if( !CV_ARE_CNS_EQ( src, dst ))
|
||||
{
|
||||
temp = cvCreateMat( src->height, src->width,
|
||||
(src->type & CV_MAT_CN_MASK)|(dst->type & CV_MAT_DEPTH_MASK));
|
||||
cvConvertScale( src, temp, scale, shift );
|
||||
src = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvConvertScale( src, dst, scale, shift );
|
||||
src = dst;
|
||||
}
|
||||
}
|
||||
|
||||
if( src_cn != dst_cn || (src_cn == 3 && swap_rb) )
|
||||
{
|
||||
uchar *s = src->data.ptr, *d = dst->data.ptr;
|
||||
int s_step = src->step, d_step = dst->step;
|
||||
int code = src_cn*10 + dst_cn;
|
||||
CvSize size = {src->cols, src->rows};
|
||||
|
||||
if( CV_IS_MAT_CONT(src->type & dst->type) )
|
||||
{
|
||||
size.width *= size.height;
|
||||
size.height = 1;
|
||||
s_step = d_step = /*CV_STUB_STEP*/ (1 << 30);
|
||||
}
|
||||
|
||||
switch( code )
|
||||
{
|
||||
case 13:
|
||||
icvCvt_Gray2BGR_8u_C1C3R( s, s_step, d, d_step, size );
|
||||
break;
|
||||
case 31:
|
||||
icvCvt_BGR2Gray_8u_C3C1R( s, s_step, d, d_step, size, swap_rb );
|
||||
break;
|
||||
case 33:
|
||||
CV_Assert(swap_rb);
|
||||
icvCvt_RGB2BGR_8u_C3R( s, s_step, d, d_step, size );
|
||||
break;
|
||||
case 41:
|
||||
icvCvt_BGRA2Gray_8u_C4C1R( s, s_step, d, d_step, size, swap_rb );
|
||||
break;
|
||||
case 43:
|
||||
icvCvt_BGRA2BGR_8u_C4C3R( s, s_step, d, d_step, size, swap_rb );
|
||||
break;
|
||||
default:
|
||||
CV_ERROR( CV_StsUnsupportedFormat, "Unsupported combination of input/output formats" );
|
||||
}
|
||||
src = dst;
|
||||
}
|
||||
|
||||
if( flags & CV_CVTIMG_FLIP )
|
||||
{
|
||||
CV_CALL( cvFlip( src, dst, 0 ));
|
||||
}
|
||||
else if( src != dst )
|
||||
{
|
||||
CV_CALL( cvCopy( src, dst ));
|
||||
}
|
||||
|
||||
__END__;
|
||||
|
||||
cvReleaseMat( &temp );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user