< Back to IRCAM Forum

Image contour and data transfer to BPF/BPC

Hi!

I have a photo of an mountainous landscape wherefrom I want to extrapolate its contours and transfer it to BPF/BPC.
(The contours from the image I can extrapolate with other program and save it as separate image, but how to transfer it to BPF/BPC?)

Did anybody do something similar in OM?

Hoping for some help!

All the best!

Ališer

1 Like

Dear Aliser,

The ideal thing is to use SVG format. I have something like that which can suit you. However, i am having problems with the coordinates from the application (inkscape) to OM that appears not to be the same, i.e they are flipped. So for the time being this is a code in progress. Will let you know when it is ready, and will make it available ASAP.

Best
K

1 Like

Dear Karim,

So nice to hear from you and thank you for your fast reply!

I was trying also to approach the problem with transfer of image contours in a other way. I was using graphic tools (pen) in a picture to outline the contours in a photo by hand and afterwards to extrapolate a graphic-object relative to the height and width of the image in order to transfer it to BPF/BPC, but I don’t understand the third output [graph-point list of (x y)] from the graphic-object, which outputs a list of pairs of fractions (?). How to “translate” this kind of list to x and y inputs of a BPF/BPC?
Would this approach be easier or am I missing some basic concept?

Thank you once more and I wish you all the best!

Ališer

Dear Aliser,

Ok, got it !
Well the third output is all added drawings you will do and here is a way to do it:

Some explanations:
You will notice i have drawn (sorry i am a very lousy artist!) some contours, one in red, the other in green.

We will use the third output to retrieve these. (apparently it is in the order of creation)

Then i will use the graph-points access slot to obtain them

Then a mat-trans is ncessary to separate the xy pairs.

Notice here the *-1 necessary to flip the contour.

There you have it…

The patch with the picture. (on the picture is Giacometti)
Patch 5.omp (25.7 KB)

Best
K

Dear Karim,

As always, you are the saver! Now I can continue working!

Thank you very much and all the best!

Ališer

ps. As a complementary info, you can also directly load an image as the background of a BPF or BPC (right-click then “Background piture”), and draw points inside the the editor, directly on top of this picture.

Hi,

And is there any conceivable way of transforming raster pictures (Width X Height) into chord-objects ( Milliseconds X MIDIcents, with pixel brightness as velocity)? It would be an awesome way of doing graphical scores in OpenMusic.

All the best,
António

You could give a try to the “pixels” library:

The library comes with a set of help patches. It provides different means access and filter the pixels as a 2D array. You can probably use the output values to do whatever you want :slight_smile:

1 Like

Hi Jean,

Thanks, time to permanently scarr my neighbor’s sweet cocker spaniel — bad joke, no animal abuse shall occur during my experiments (other than on myself, probably.)

All the best,
António

1 Like

Hallo again,

Is there a way to import graphic (drawing) to BPF/BPC from an external drawing application?

I am doing sonification of contours on a photography. I am drawing contours by hand on photo background using OM class Picture and connect it to BPF/BPC for further manipulation. Yet, it is very unhandy to make precise drawing in OM class Picture. (It has very basic graphic tools and it is very hard to draw with a mouse.) Is it possible to make drawing in some external drawing application and then to OM with possibility to use it in BPF/BPC? If so, what graphic format is recognised by OM and may be transferable to BPF/BPC?

All the best!

Hi Aliser,

I recommend using svg format. You can import it with import-svg which renders a bpc.
But this is still experimental. You should be only using lines no circle and rectangle svg objects. I use inkscaoe for that.

Hope this helps.

Best
K

Dear Karim,
I will do so.

Thank you very much and all the best to you too!

Dear Karim,

I did as you said, but which is the way to import SVG file to BPC? Where do I find function import-svg?
Please can you explain it more precisely?

All the best!

Dear Aliser,

It is new in the 6.19 version. Try it out.
I believe you are using an old version. If you qre on mac you can install as many OM version you like along. So try it.

Best
K

…and here is an example:

Best
K