
8路網絡繼電器 IP繼電器 Web Relay 雙控本地 手機 遠程控制 /安卓 蘋果 平板 windows系統 NT $1,500 一、功能(Feature): 1. 以太網RJ45介面 。 2. 板載WEB伺服器,可通過web方式訪問並控制。


1: /**
2: * \brief Automatic brightness and contrast optimization with optional histogram clipping
3: * \param [in]src Input image GRAY or BGR or BGRA
4: * \param [out]dst Destination image
5: * \param clipHistPercent cut wings of histogram at given percent tipical=>1, 0=>Disabled
6: * \note In case of BGRA image, we won't touch the transparency
7: */
8: void BrightnessAndContrastAuto(const cv::Mat &src, cv::Mat &dst, float clipHistPercent=0)
9: { 10: 11: CV_Assert(clipHistPercent >= 0); 12: CV_Assert((src.type() == CV_8UC1) || (src.type() == CV_8UC3) || (src.type() == CV_8UC4)); 13: 14: int histSize = 256;
15: float alpha, beta;
16: double minGray = 0, maxGray = 0;
17: 18: //to calculate grayscale histogram
19: cv::Mat gray;20: if (src.type() == CV_8UC1) gray = src;
21: else if (src.type() == CV_8UC3) cvtColor(src, gray, CV_BGR2GRAY);
22: else if (src.type() == CV_8UC4) cvtColor(src, gray, CV_BGRA2GRAY);
23: if (clipHistPercent == 0)
24: {25: // keep full available range
26: cv::minMaxLoc(gray, &minGray, &maxGray); 27: }28: else
29: {30: cv::Mat hist; //the grayscale histogram
31: 32: float range[] = { 0, 256 };
33: const float* histRange = { range };
34: bool uniform = true;
35: bool accumulate = false;
36: calcHist(&gray, 1, 0, cv::Mat (), hist, 1, &histSize, &histRange, uniform, accumulate); 37: 38: // calculate cumulative distribution from the histogram
39: std::vector<float> accumulator(histSize);
40: accumulator[0] = hist.at<float>(0);
41: for (int i = 1; i < histSize; i++)
42: {43: accumulator[i] = accumulator[i - 1] + hist.at<float>(i);
44: } 45: 46: // locate points that cuts at required value
47: float max = accumulator.back();
48: clipHistPercent *= (max / 100.0); //make percent as absolute
49: clipHistPercent /= 2.0; // left and right wings
50: // locate left cut
51: minGray = 0;52: while (accumulator[minGray] < clipHistPercent)
53: minGray++; 54: 55: // locate right cut
56: maxGray = histSize - 1;57: while (accumulator[maxGray] >= (max - clipHistPercent))
58: maxGray--; 59: } 60: 61: // current range
62: float inputRange = maxGray ...






