107 lines
2.5 KiB
C
Raw Normal View History

#include "PikaCV_common.h"
#include "PikaCV_Converter.h"
int PikaCV_Format_Check(PikaObj* image,PikaCV_ImageFormat_Type type,PikaCV_Check_ReturnMode returnMode){
// return mode: 0
// 1
// 2
//PikaObj* self;
PikaCV_Image* src = obj_getStruct(image, "image");
switch (returnMode)
{
case PikaCV_Check_ReturnError:
if(src->format != type){
//obj_setErrorCode(self, PIKA_RES_ERR_OPERATION_FAILED);
return 0;
}else{
return 1;
}
break;
case PikaCV_Check_Converter:
/* code */
if(src->format != type){
PikaCV_Converter_converter((PikaObj*)NULL,type,image);
return 0;
}else{
return 1;
}
break;
default:
return 0;
break;
}
}
int PikaCV_Format_CheckTwo(PikaObj* image1,PikaObj* image2,PikaCV_Check_ReturnMode returnMode){
//PikaObj* self;
PikaCV_Image* src1 = obj_getStruct(image1, "image");
PikaCV_Image* src2 = obj_getStruct(image2, "image");
switch (returnMode)
{
case PikaCV_Check_ReturnError:
if(src1->format != src2->format){
//obj_setErrorCode(self, PIKA_RES_ERR_OPERATION_FAILED);
return 0;
}else{
return 1;
}
break;
case PikaCV_Check_Converter:
/* code */
if(src1->format != src2->format){
PikaCV_Converter_converter((PikaObj*)NULL,src1->format,image2);
return 0;
}else{
return 1;
}
break;
default:
break;
}
return 0;
}
int PikaCV_Size_Check(PikaObj* image1,PikaObj* image2,PikaCV_Check_SizeMode sizeMode){
//sPikaObj* self;
PikaCV_Image* src1 = obj_getStruct(image1, "image");
PikaCV_Image* src2 = obj_getStruct(image2, "image");
switch (sizeMode)
{
case PikaCV_Check_Size:
/* code */
if(src1->size != src2->size){
return 0;
}else{
return 1;
}
break;
case PikaCV_Check_SHW:
/* code */
if(src1->size != src2->size || src1->height!= src2->height || src1->width != src2->width){
return 0;
}else{
return 1;
}
break;
case PikaCV_Check_HW:
/* code */
if(src1->height!= src2->height || src1->width != src2->width){
return 0;
}else{
return 1;
}
break;
default:
break;
}
return 0;
}