0
$\begingroup$

Given an input signal(ex. sine) how can one go about plotting an image like below ones(the stripped black and white image)?

The images are fromthese slides on image processing.

enter image description here

Or this one:

enter image description here

askedNov 13, 2017 at 8:08
ali's user avatar
$\endgroup$
2
  • $\begingroup$You need to explain where you're stuck. Your first example even includes all the Matlab code needed to make the image!$\endgroup$CommentedNov 13, 2017 at 14:15
  • $\begingroup$Thanks. I was not clear as to how get pixel colour based on the function. It works now$\endgroup$CommentedNov 13, 2017 at 15:11

1 Answer1

1
$\begingroup$

If you're using Python, you can use a library such as matplotlib for this. It can take a numpy array and plot it as a standard chart using the functionplot or as an image usingimshow. The resulting image/plot can be displayed in an interactive window, or saved to a file, or it shows inline in your Jupyter notebook if you're using that.

There are other (better?) Python chart plotting libraries but the functionality is basic and IMO matplotlib is easier to get started with (perhaps just because it's older and more established).

You can also do this using OpenCV, if your input is an OpenCV image. Its plotting functions are named similarly to the matplotlib ones. OpenCV is available in Python, C++, and a handful of other languages.

answeredNov 13, 2017 at 9:49
Dan Hulme's user avatar
$\endgroup$
4
  • $\begingroup$Thank you for the answer. but what is the algorithm if I one wants to implement it and not using 3rd parties? I use c# language.$\endgroup$CommentedNov 13, 2017 at 10:18
  • $\begingroup$Just to note that my question referred to how the black and white stripped image is created given the sine or whatever signal.$\endgroup$CommentedNov 13, 2017 at 10:28
  • $\begingroup$In that case, could you edit your question and make it clearer? Regardless of language, the short answer is "make an array of values from your function and then convert it into the image type you're using".$\endgroup$CommentedNov 13, 2017 at 10:40
  • $\begingroup$Sorry about the question not being clear enough. I have updated it. I still don't understand how to do it could you give an example please.$\endgroup$CommentedNov 13, 2017 at 12:04

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.