remap

OpenCV remap interpolation error?

安稳与你 提交于 2019-12-05 10:07:45
I'm using opencv remap function to map an image to another coordinate system. However, my initial tests indicate that there are some issues with the interpolation. Here, I give a simple example of a constant 0.1 pixel shift for a image that is 0 everywhere but at position [50,50]. import cv2 import numpy as np prvs = np.zeros((100,80), dtype=np.float32) prvs[50:51, 50:51] = 1. grid_x, grid_y = np.meshgrid(np.arange(prvs.shape[1]), np.arange(prvs.shape[0])) grid_y = grid_y.astype(np.float32) grid_x = grid_x.astype(np.float32) + 0.1 prvs_remapped = cv2.remap(prvs, grid_x, grid_y, interpolation

How to disable a built-in command in vim

烈酒焚心 提交于 2019-12-05 03:21:30
In vim, when I hit :wq it is almost always an accident that occurred when attempting to input :w . I would like to disable :wq . The closest I found is cmap , but it has some odd behavior. If I do something like :cmap wq w I can no longer even input :wq ; it just remaps the keystroke sequence wq to w in command mode. Now I cannot, for example, input a search/replace command on a string containing wq . I would just like to alias the exact command :wq to :w or a no-op. Is there a way to do this? EDIT: clarified why :cmap is not an option for me A better solution can be: :cabbrev wq w But I'm not

Passing multiple optional parameter/value pairs with user defined pair order

人盡茶涼 提交于 2019-12-04 19:59:41
Say user is going to search on 4 or 5 fields, ok? eg. he might want to search by firstname, email, mobile or even page number I want that codeigniter's url be like this: site.com/Controller/Method/variable1/value1/variable2/value2/variable3/value3 or site.com/Controller/Method/variable2/value2/variable3/value3/variable1/value1 (that they should have the same result) or in this format site.com/Controller/Method/variable2/value2/variable4/value4 some examples to clarify my question: site.com/user/search/firstname/John/mobile/123/page/2 or: site.com/user/search/lastname/Smith/email/gmail.com In

Using OpenCV remap function crops image

血红的双手。 提交于 2019-12-04 16:59:00
I am trying to warp an 640x360 image via the OpenCV remap function (in python 2.7). The steps executed are the following Generate a curve and store its x and y coordinates in two seperate arrays, curve_x and curve_y.I am attaching the generated curve as an image(using pyplot): Load image via the opencv imread function original = cv2.imread('C:\\Users\\User\\Desktop\\alaskan-landscaps3.jpg') Execute a nested for loop so that each pixel is shifted upwards in proportion to the height of the curve at that point.For each pixel I calculate a warping factor by dividing the distance between the curve

Vim: remap key to toggle line numbering

余生颓废 提交于 2019-12-03 11:17:32
问题 I added: set number nnoremap <F2> :set nonumber! to my vimrc file. Basically what it's supposed to do is let me press F2 to toggle line numbering but it's not working. What have I done wrong? 回答1: In your .vimrc , add this: set number nnoremap <F2> :set nonumber!<CR> Then pressing F2 will turn on line numbering if it is off, and turn it off if it is on. 回答2: This is what I use (with a different key binding): nmap <f2> :set number! number?<cr> The "number!" toggles the setting and "number?"

Converting opencv remap code from c++ to python

风流意气都作罢 提交于 2019-12-02 15:11:49
问题 I am trying to convert c++ opencv cv2.remap code to python. I am not getting any error but result is not as expected.I am getting zoomed image c++ code int main() { Mat img = imread("captcha1.jpg"); float phase = -0.8 * CV_PI; float omega = 2.0 * CV_PI / img.cols; float amp = 15; Mat_<Vec2f> proj(img.size()); for (int y=0; y<img.rows; y++) { for (int x=0; x<img.cols; x++) { float u = 0; float v = sin(phase + float(x) * omega) * amp; proj(y,x) = Vec2f(float(x) + u, float(y) + v); } } Mat corr;

Converting opencv remap code from c++ to python

匆匆过客 提交于 2019-12-02 08:11:22
I am trying to convert c++ opencv cv2.remap code to python. I am not getting any error but result is not as expected.I am getting zoomed image c++ code int main() { Mat img = imread("captcha1.jpg"); float phase = -0.8 * CV_PI; float omega = 2.0 * CV_PI / img.cols; float amp = 15; Mat_<Vec2f> proj(img.size()); for (int y=0; y<img.rows; y++) { for (int x=0; x<img.cols; x++) { float u = 0; float v = sin(phase + float(x) * omega) * amp; proj(y,x) = Vec2f(float(x) + u, float(y) + v); } } Mat corr; cv::remap(img, corr, proj, cv::Mat(), INTER_LINEAR); imshow("in",img); imshow("out",corr); waitKey();

Jumping from one firmware to another in MCU internal FLASH

一曲冷凌霜 提交于 2019-11-30 16:05:13
I am currently working on a bootloader firmware application targeted to STM32F030C8. I specified in my scatter file that the bootloader app will occupy main memory location 0x08000000 to 0x08002FFF (sector 0 to sector 2). I also wrote a main firmware application that is stored from 0x08003000 to 0x0800C800. After downloading both firmware to the MCU internal FLASH, I lauched the main app from the bootloader using the code below: /************************************************************//** * \brief Start the main application if available and correct ****************************************

Inverting a real-valued index grid

╄→尐↘猪︶ㄣ 提交于 2019-11-30 03:52:17
OpenCV's remap() uses a real-valued index grid to sample a grid of values from an image using bilinear interpolation, and returns the grid of samples as a new image. To be precise, let: A = an image X = a grid of real-valued X coords into the image. Y = a grid of real-valued Y coords into the image. B = remap(A, X, Y) Then for all pixel coordinates i, j, B[i, j] = A(X[i, j], Y[i, j]) Where the round-braces notation A(x, y) denotes using bilinear interpolation to solve for the pixel value of image A using float-valued coords x and y . My question is: given an index grid X , Y , how can I

Inverting a real-valued index grid

此生再无相见时 提交于 2019-11-28 23:02:56
问题 OpenCV's remap() uses a real-valued index grid to sample a grid of values from an image using bilinear interpolation, and returns the grid of samples as a new image. To be precise, let: A = an image X = a grid of real-valued X coords into the image. Y = a grid of real-valued Y coords into the image. B = remap(A, X, Y) Then for all pixel coordinates i, j, B[i, j] = A(X[i, j], Y[i, j]) Where the round-braces notation A(x, y) denotes using bilinear interpolation to solve for the pixel value of