| @@ -294,6 +294,9 @@ static bool ConvertRGBAToGRAY(const unsigned char *data, LDataType data_type, in | |||||
| } | } | ||||
| bool InitFromPixel(const unsigned char *data, LPixelType pixel_type, LDataType data_type, int w, int h, LiteMat &m) { | bool InitFromPixel(const unsigned char *data, LPixelType pixel_type, LDataType data_type, int w, int h, LiteMat &m) { | ||||
| if (data == nullptr) { | |||||
| return false; | |||||
| } | |||||
| if (w <= 0 || h <= 0) { | if (w <= 0 || h <= 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -517,6 +520,9 @@ bool Pad(const LiteMat &src, LiteMat &dst, int top, int bottom, int left, int ri | |||||
| if (top <= 0 || bottom <= 0 || left <= 0 || right <= 0) { | if (top <= 0 || bottom <= 0 || left <= 0 || right <= 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (src.IsEmpty()) { | |||||
| return false; | |||||
| } | |||||
| if (pad_type == PADD_BORDER_CONSTANT && src.data_type_ == LDataType::FLOAT32) { | if (pad_type == PADD_BORDER_CONSTANT && src.data_type_ == LDataType::FLOAT32) { | ||||
| PadWithConstant<float>(src, dst, top, bottom, left, right, pad_type, fill_b_or_gray, fill_g, fill_r); | PadWithConstant<float>(src, dst, top, bottom, left, right, pad_type, fill_b_or_gray, fill_g, fill_r); | ||||
| } else if (pad_type == PADD_BORDER_CONSTANT && src.data_type_ == LDataType::UINT8) { | } else if (pad_type == PADD_BORDER_CONSTANT && src.data_type_ == LDataType::UINT8) { | ||||