记录1
Signed-off-by: lls <staying_liu_1@163.com>
This commit is contained in:
parent
b8f5bb14fb
commit
5467684710
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -40,3 +40,28 @@ void opencv_t::visit_xiangsu(Mat& temp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void opencv_t::visit_xiangsu(Mat& temp, int a)
|
||||
{
|
||||
int w = temp.cols;
|
||||
int h = temp.rows;
|
||||
int dims = temp.channels();
|
||||
for (int row = 0; row < h; row++)
|
||||
{
|
||||
uchar* curr = temp.ptr<uchar>(row);
|
||||
for (int col = 0; col < w; col++)
|
||||
{
|
||||
if (dims == 1)
|
||||
{
|
||||
int pv = *curr;
|
||||
*curr++ = 255 - pv;
|
||||
}
|
||||
else if (dims == 3)
|
||||
{
|
||||
*curr++ = 255 - *curr;
|
||||
*curr++ = 255 - *curr;
|
||||
*curr++ = 255 - *curr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ public:
|
||||
~opencv_t();
|
||||
static opencv_t* create_new();
|
||||
void visit_xiangsu(Mat& temp);//MatĎńËŘśÁĐ´ˇĂÎĘ
|
||||
|
||||
void visit_xiangsu(Mat& temp,int a);//MatÏñËØ¶Áд·ÃÎÊ,
|
||||
private:
|
||||
|
||||
};
|
||||
|
2
test.cpp
2
test.cpp
@ -14,7 +14,7 @@ int main(int argc, char** argv)
|
||||
Mat gray, hsv;
|
||||
|
||||
opencv_t* csss = opencv_t::create_new();
|
||||
csss->visit_xiangsu(src);
|
||||
csss->visit_xiangsu(src,1);
|
||||
//cvtColor(src, hsv, COLOR_BGR2HSV);
|
||||
imshow("ĘäČëÍźĎń", src);
|
||||
waitKey(0);
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user