绘制由(方向,频率,相移,振幅)表示的波使用OpenCv [英] Drawing a Wave represented by (Orientation, Frequency, Phase-shift, Amplitude) Using OpenCv

查看:440
本文介绍了绘制由(方向,频率,相移,振幅)表示的波使用OpenCv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个空白图像,并从用户那里获取参数,包括波形方向,波频率,相移,波幅。

I want to create an empty image and take parameters from user, which are Wave Orientation, Wave Frequency, Phase-shift, Wave Amplitude.

给出类似于以下图像的输出:

And I have to give an output similar to the following image:

我的问题:


  • 如何在空白图片中绘制波浪?

  • 使用?

推荐答案

我想你可以执行以下步骤因为我没有测试它):

I guess you can do the following steps (but I am not sure, since I didn't test it):


  1. 使用需要的波频率,相移和波幅的正弦函数来计算一行中的像素值。使用正弦和规范化可能会看起来像这样:

  1. Use sine function with needed Wave Frequency, Phase-shift and Wave Amplitude to calculate values of pixels in one row. Possibly it will look like this with using sine and normalization:

for(int j = 0; j< I.cols; ++ j )
I.at< uchar>(i,j)=(Amplitude * sin(frequency * j + PhaseShift)+1)/ 2 * 255;

将第一行复制到其他行以接收垂直线等。

Copy first row to other rows for receiving something like vertical lines.

使用 cv :: getRotationMatrix2D cv :: warpAffine 来获取所需的波向。

Use cv::getRotationMatrix2D and cv::warpAffine to get needed wave orientation.

这篇关于绘制由(方向,频率,相移,振幅)表示的波使用OpenCv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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