instruction
stringlengths 1
910
| input
stringclasses 1
value | output
stringlengths 19
270k
| system
stringclasses 1
value |
---|---|---|---|
How to transform a video (using MATLAB) which was taken at an offset to correct viewing angle? | <p>For a super easy fix, go back to the scene and take the video again. This time, make sure the circle look like a circle.</p>
<p>That being said, this is an interesting topic in the academia. I believe there's various solutions/articles that are aimed to solve this kind of problem. Base on your reputation, I believe you already know that, but still wanted to give Stackoverflow members a shot at answering this problem. So here it goes.</p>
<p>For an easy fix, you can start with <a href="http://www.mathworks.com/matlabcentral/fileexchange/2805-trans-camera-view/content/func_transcameraview/func_transcameraview.m" rel="nofollow">this function</a>, by guessing the camera location by trial and error until you find an acceptable transformation to your image (a frame of the video). The function does not work right out of the box, you have to debug it a little bit.</p>
<p>If you have access to the (virtual) scene of the image, you can take an image. Base on mutual feature points from the new image and the original image, register the two images (and get the transformation) (<a href="http://www.mathworks.com/matlabcentral/fileexchange/22337-robust-nonrigid-point-set-registration" rel="nofollow">ex1</a>, <a href="http://www.mathworks.com/matlabcentral/fileexchange/28305-estimaterigidtransform" rel="nofollow">ex2</a>).</p>
<p>Finally, apply the same transformation to each frame of the video.</p>
<p>To answer your second question, though the camera location is fixed, there may be objects moving in the scene. So applying the same transformation to every frame will only correct the objects that are still. So it's not ideal. In the end, it depends on what the aims of the project is and how this non/correction affects the project aims.</p>
| ||
How to provide region of interest (ROI) for edge detection and corner detection in Matlab? | <p>If you already extracted the frames, you can use <strong>imroi</strong> and <strong>roifilt2</strong>. </p>
<p>Check out the following section from help:<br>
<a href="http://www.mathworks.com/help/toolbox/images/f19-12807.html" rel="nofollow">http://www.mathworks.com/help/toolbox/images/f19-12807.html</a></p>
| ||
OpenCV python's API: FlannBasedMatcher | <p>Looking in the examples provided by OpenCV 2.3.1 under the python2 folder, I found an implementation of a flann based match function which doesn't rely on the FlanBasedMatcher object.</p>
<p>Here is the code:</p>
<pre><code>FLANN_INDEX_KDTREE = 1 # bug: flann enums are missing
flann_params = dict(algorithm = FLANN_INDEX_KDTREE,
trees = 4)
def match_flann(desc1, desc2, r_threshold = 0.6):
flann = cv2.flann_Index(desc2, flann_params)
idx2, dist = flann.knnSearch(desc1, 2, params = {}) # bug: need to provide empty dict
mask = dist[:,0] / dist[:,1] < r_threshold
idx1 = np.arange(len(desc1))
pairs = np.int32( zip(idx1, idx2[:,0]) )
return pairs[mask]
</code></pre>
| ||
an issue of getting Matrix for training sift features | <p>Have you looked at the <a href="https://code.ros.org/svn/opencv/trunk/opencv/samples/cpp/descriptor_extractor_matcher.cpp" rel="nofollow">descriptor_extractor_matcher.cpp</a>, or the <a href="https://code.ros.org/svn/opencv/trunk/opencv/samples/cpp/matcher_simple.cpp" rel="nofollow">matcher_simple.cpp</a> samples from OpenCV? Also, could you post the code you are using to detect the features?</p>
|