|
@@ -4,31 +4,6 @@
|
|
using namespace cv;
|
|
using namespace cv;
|
|
using namespace std;
|
|
using namespace std;
|
|
|
|
|
|
-void show(Mat src, const char wd[], float i = 0.3) {
|
|
|
|
-
|
|
|
|
- int maxs = src.cols > src.rows ? src.cols : src.rows;
|
|
|
|
- float ra = 400 / (maxs + DBL_MIN);
|
|
|
|
- i = ra;
|
|
|
|
- //------չʾͼÏñ²Ù×÷------
|
|
|
|
- namedWindow(wd, WINDOW_FREERATIO);
|
|
|
|
- if (i > 100)
|
|
|
|
- {
|
|
|
|
- resizeWindow(wd, i, i);//´°¿Ú³ß´çµ÷½Ú
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- resizeWindow(wd, int(i * src.cols), int(i * src.rows));//´°¿Ú³ß´çµ÷½Ú
|
|
|
|
- }
|
|
|
|
- Mat src1 = src.clone();
|
|
|
|
- src1.convertTo(src1, 5);
|
|
|
|
- normalize(src1, src1, 0, 1, NORM_MINMAX);
|
|
|
|
-
|
|
|
|
- imshow(wd, src1);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- waitKey(0);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int applyMask(unsigned short* input, unsigned char* pmask, int Width, int Height, unsigned short* output)
|
|
int applyMask(unsigned short* input, unsigned char* pmask, int Width, int Height, unsigned short* output)
|
|
{
|
|
{
|
|
if (input == nullptr)
|
|
if (input == nullptr)
|
|
@@ -97,23 +72,3 @@ int cropImg(unsigned short *input, unsigned short *output, int Width, int Height
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-int main()
|
|
|
|
-{
|
|
|
|
- Mat input = imread(R"(Image_FinalImage.tif)",-1);
|
|
|
|
- Mat mask = imread(R"(mask.tif)", -1);
|
|
|
|
-
|
|
|
|
- int x = 0;
|
|
|
|
- int y = 0;
|
|
|
|
- int width = 0;
|
|
|
|
- int height = 0;
|
|
|
|
- getMaskRect(mask.ptr<uchar>(), input.cols, input.rows, x, y, width, height);
|
|
|
|
-
|
|
|
|
- unsigned short* output = new unsigned short[width * height];
|
|
|
|
- cropImg(input.ptr<ushort>(), output,input.cols,input.rows,x,y,width,height);
|
|
|
|
-
|
|
|
|
- Mat result(Size(width, height), CV_16U, output);
|
|
|
|
- show(result, "result");
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|