我正在尝试使用 opencv 增强水下视频图像。对象检测发生在 HSV 颜色空间中。在此之前,我一直在尝试找出消除水中颜色失真的技术。我读到的一种技术是对比拉伸 RGB 颜色空间,然后在 HSI 中拉伸饱和度和强度。
为了产生类似的东西,我想出了在 BGR 上使用归一化,然后转换为 HSV 并对饱和度和值进行归一化。这似乎并不能消除蓝色。我的订单有问题还是我错过了水下图像增强功能?
while(1){
//store image to matrix
capture.read(cameraFeed);
feedClone = cameraFeed.clone();
Mat HSV;
vector<Mat> channels;
vector<Mat> hsv_planes;
/*This is the part I am hoping to get feedback on*/
split(cameraFeed,channels);
normalize(channels[0], channels[0], 0, 255, NORM_MINMAX);
normalize(channels[1], channels[1], 0, 255, NORM_MINMAX);
normalize(channels[2], channels[2], 0, 255, NORM_MINMAX);
merge(channels,cameraFeed);
cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);
hsv_planes.clear();
split(HSV,hsv_planes);
normalize(hsv_planes[1], hsv_planes[1], 0, 255, NORM_MINMAX);
normalize(hsv_planes[2], hsv_planes[2], 0, 255, NORM_MINMAX);
merge(hsv_planes,HSV);
cvtColor(HSV,cameraFeed,COLOR_HSV2BGR);
/*This is what happens next and works perfectly out of water without the above adjustments*/
//This finds the specific color in the threshold
cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);
inRange(HSV,orange.getHSVmin(),orange.getHSVmax(),threshold);
//this function runs the threshold through 2 erodes and 2 dilates
//then a median blur (7,7)
morphOps(threshold);
//this tracks that image in the feed
trackFilteredObject(orange,threshold,HSV,feedClone);
}