拍摄一个在openCV C ++中旋转的管子的图像 [英] Take a image of a tube that alway spin around in openCV C++

查看:165
本文介绍了拍摄一个在openCV C ++中旋转的管子的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,抱歉我的英文不好,
我有一个像下面的图片一样的对象,对象总是围绕水平轴旋转。任何人都可以推荐我如何在管子旋转时拍出一张完整标签的照片?我可以通过OpenCV C ++从我的相机拍摄图像,但是当我试图旋转管时,我无法拍摄完美的照片(我的图像模糊,不清楚)。
我的电子管完全面向相机。其转速约为500 RPM。
希望尽快得到你的帮助,
非常感谢你!
这是我的对象:



一些示例图片:







当我使用带闪光灯的Ip5相机时我的图像:



解决方案


  1. 运动模糊



    这可以通过降低曝光时间来改善,但你需要增加光线条件来补偿。大多数现代小型相机无法直接设置曝光时间(因此公司可以出售昂贵的profi相机),即使它只是几行GUI代码,但如果增加光线,自动曝光应该自行降低。



    在行业中,这个问题通过特殊的 TDI 相机解决,例如





      1. 因此安装相机,使其视轴垂直于表面。

      2. 拍摄连拍或视频为恒定帧-rate



        曝光时间越短(帧速率越高)整个图像的聚焦度越高(由于光学模糊),面积越大 dy 来自运动模糊。旋转 RPM 越高, dy 越小。因此,找到适合您相机的最佳选择, RPM 和照明条件(如果管上没有反光表面,通常会增加强光效果)。



        要获得正确的输出,您需要妥协每个参数,以便:




        • 曝光时间尽可能短

        • 重点区域在镜头之间重叠(如果不是,你可以采样类似于旧FDD扇区阅读的更多轮次......)


      3. 提取镜头的重点部分



        你只需要所有镜头的中间部分,所以凭经验从你的镜头中取出一些镜头设置并选择 dy 大小。然后将其用作后者。因此从镜头中提取中间部分(切片)。在我的示例图片中,它是红色区域。


      4. 组合切片



        您只需将切片复制(或平均重叠部分)。它们应该重叠一点,以便在最终图像中没有孔。你可以看到我的最终图像示例有较小的切片,然后获得,以使其更明显。



        由于振动你的相机图像可能会偏少几个像素所以如果是在最终图像中出现问题,您可以使用 SIFT / SURF + RANSAC 进行自动拼接以获得更高精度的输出。



      First of all, sorry for my bad English, I have an object like following picture, the object always spin around a horizontal axis. Anybody can recommend me how to I can take a photo that's full label of tube when the tube is spinning ? I can take a image from my camera via OpenCV C++, but when I'm trying to spin the tube around, I can't take a perfect photo (my image is blurry, not clearly). My tube is perfectly facing toward camera. Its rotating speed is about 500 RPM. Hope to get your help soon, Thank you very much! this is my object:

      Some sample images:

      Here my image when I use camera of Ip5 with flash:

      解决方案

      1. Motion blur

        this can be improved by lowering the exposure time but you need to increase light conditions to compensate. Most modern compact cameras can not set the exposure time directly (so the companies can sold the expensive profi cameras) even if it is just few lines of GUI code but if you increase the light the automatic exposure should lower on its own.

        In industry this problem is solved by special TDI cameras like

        The TDI means Time delay integration which means the camera CCD pixels are passing its charge to the next pixel synchronized with the motion. This results in effect like you would move the camera synchronously with your object surface. The blur is still present but much much smaller (only a fraction of real exposure time)

        In computer vision and DIP you can de-blur the image by deconvolution process if you know the movement properties (which you know) It is inversion of gaussian blur filter with use of FFT and optimization process to find the inverse filter.

      2. Out of focus blur

        This is due the fact your surface is curved and camera chip is not. So outer pixels have different distance to chip then the center pixels. Without special optics you can handle this by Line cameras. Of coarse I do not expect you got one so you can use your camera for this too.

        Just mount your camera so one of the camera axis is parallel to you object rotation axis (surface) for example x axis. Then sample more images with constant time step and use only the center line/slice of the image (height of the line/slice depends on your exposure time and the object speed, they should overlap a bit). then just combine these lines/slices from all the sampled images to form the focused image .

      [Edit1] home made TDI setup

      1. So mount camera so its view axis is perpendicular to surface.
      2. Take burst shots or video with constant frame-rate

        The shorter exposure time (higher frame-rate) the more focused whole image will be (due to optical blur) and the bigger area dy from motion blur. And the higher the rotation RPM the smaller the dy will be. So find the best option for your camera,RPM and lighting conditions (usually adding strong light helps if you do not have reflective surfaces on the tube).

        For correct output you need to compromise each parameter so:

        • exposure time is as short as it can
        • focused areas are overlapping between the shots (if not you can sample more rounds similar to old FDD sector reading...)
      3. extract focused part of shots

        You need just the focused middle part of all shots so empirically take few shots from your setup and choose the dy size. Then use that as a constant latter. So extract the middle part (slice) from the shots. In my example image it is the red area.

      4. combine slices

        You just copy (or average overlapped part) the slices together. They should overlap a bit so you do not have holes in final image. As you can see my final image example has smaller slices then acquired to make that more obvious.

        Your camera image can be off by few pixels due to vibrations so If that is a problem in final image then you can use SIFT/SURF + RANSAC for auto-stitching for higher precision output.

      这篇关于拍摄一个在openCV C ++中旋转的管子的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆