You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
typedef unsigned char uchar;
|
|
|
|
|
|
|
|
|
|
namespace MN_VisionImage {
|
|
|
|
|
|
|
|
|
|
enum class ME_ImageType
|
|
|
|
|
{
|
|
|
|
|
E_GRAY = 0,
|
|
|
|
|
E_RGB,
|
|
|
|
|
E_RGBA
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct MS_ImageParam
|
|
|
|
|
{
|
|
|
|
|
//<2F>ι<DEB2><CEB9><EFBFBD>
|
|
|
|
|
MS_ImageParam() :
|
|
|
|
|
m_width(-1),
|
|
|
|
|
m_height(-1),
|
|
|
|
|
m_channels(0),
|
|
|
|
|
mImgType(MN_VisionImage::ME_ImageType::E_RGB)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
//<2F>вι<D0B2><CEB9>캯<EFBFBD><ECBAAF>
|
|
|
|
|
MS_ImageParam(uchar* _buffer, int _nW, int _nH, const ME_ImageType& _imgType)
|
|
|
|
|
{
|
|
|
|
|
int _nChannels = 0;
|
|
|
|
|
if (_imgType == ME_ImageType::E_GRAY)
|
|
|
|
|
{
|
|
|
|
|
_nChannels = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (_imgType == ME_ImageType::E_RGBA)
|
|
|
|
|
{
|
|
|
|
|
_nChannels = 4;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_nChannels = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_width = _nW;
|
|
|
|
|
m_height = _nH;
|
|
|
|
|
m_channels = _nChannels;
|
|
|
|
|
mImgType = _imgType;
|
|
|
|
|
int iSize = _nW * _nH * _nChannels; //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_data = std::shared_ptr<uchar>(new uchar[iSize], [](uchar* p) {
|
|
|
|
|
if (p != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] p;
|
|
|
|
|
p = nullptr;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
memcpy(m_data.get(), _buffer, iSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<uchar> m_data; // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int m_width; // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int m_height; // ͼ<><CDBC><EFBFBD>߶<EFBFBD>
|
|
|
|
|
int m_channels; // ͼ<><CDBC>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
|
|
|
|
ME_ImageType mImgType; // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
}
|