jit.iter mode doubt

ciperlone's icon

I can't use mode (change from horizontal to vertical analysis of a movie) in jit.iter, and I don't understand why...
I'm able to use the vertical analysis, but not the horizontal one.

I thought it was as simple as connecting a patch chord from [mode $1] to the second [jit.iter] object of jit.iter.maxhelp

What am I doing wrong? Is there something missing?

Thank you all

Happy patching!

Bas van der Graaff's icon

If you're using the jit.iter.maxhelp file, please notice that the matrix above the second [iter] is not as big as the video. It contains only one horizontal line of the video, of which the values are displayed in the multislider. Traversing this vertically has no visible effect, as the height of the matrix is 1.

ciperlone's icon

So how can one make it to work?

I think that if I change the mode message to 1 and send it to jit.iter, ir reads a vertical line, instead of an horizontal one. Is that correct?

Is there something that I'm not understanding, or is the mode message that doesn't work?

Bas van der Graaff's icon

The mode message works fine, as far as I can see.
[jit.iter] iterates through all the cells of a matrix and outputs a value or list for each cell. The only thing the mode message changes is the order in which they're sent.

You can compare mode 0 to reading a book page and outputting each letter, and mode 1 to reading chinese (vertical).

In this example, your 'page' only contains one line of text. So it doesn't matter if you read vertically or horizontally, you get the same sequence of letters.

If you want to read a vertical line from that video, you should set up the [jit.matrix] part differently, so it keeps just 1 vertical line of data, instead of 1 horizontal line. I would use [jit.dimmap @map 1 0] to do this, but there are probably several methods. Here you go:

Max Patch
Copy patch and select New From Clipboard in Max.

ciperlone's icon

Bas van der Graaff wrote on Tue, 15 September 2009 10:25The only thing the mode message changes is the order in which they're sent.

I thought the mode message changed the order in which they're read!

Thanks for the [jit.dimmap @map 1 0] solution, I was thinking something like that to solve my problem.

Now I have everything working ok, thanks!

... but I'm still not understanding...

Bas van der Graaff wrote on Tue, 15 September 2009 10:25You can compare mode 0 to reading a book page and outputting each letter, and mode 1 to reading chinese (vertical).

I use two videos I've made to test the color detection, and it doesn't seem to work that way!
And i'm using jit.dimmap to do what the message mode is supose to do!

I'm uploading these videos in the bottom of this post. Please try them.

Here's some changes to the patch. Use those videos here (and keep them for future projects, I find them very usefull to understanding video analysis!)

Max Patch
Copy patch and select New From Clipboard in Max.

Unfortunately the link is limited to 7 Days or 100 downloads.

Upload a better link, if you please.
Enjoy!

Bas van der Graaff's icon

Read, sent, same thing right? It just reads from the matrix and outputs. I don't know how i can explain the mode attribute more clearly, it just changes around the order in which it reads from the matrix. But in this case (1 line matrix) there will be no difference.

I looked at it again, and everything works fine. Do keep in mind a few things:

- only 1 line (not an entire frame) is stored in the jit.matrix. When changing the scrdimstart thing, you should bang the movie again (with rate 0 so it displays the same image) to get a new line. (This is actually unclear from the help file, you can't just change the number only).
- you didn't change back the jit.matrix size to 320, as well as the [multislider] size, but you did remove the [jit.dimmap] from the chain.
- the matrix is on @planemap 2, which is the green plane (argb). so you'll see only one block of sliders go up as you pass the green rectangle.

I fixed those first two small things in here. Have a look, everything works as expected.

Max Patch
Copy patch and select New From Clipboard in Max.

ciperlone's icon

Thank you for your posts, Bas van der Graaff.
I was experimenting with the patch for several days, made some changes and get to some conclusions.

I didn't understand when you write
"- only 1 line (not an entire frame) is stored in the jit.matrix. When changing the scrdimstart thing, you should bang the movie again (with rate 0 so it displays the same image) to get a new line."
As I understand after practicing, I dont' need to bang the [jit.qt.movie] to get a new line. When changing the srcdim values, it sends the line just fine, even if I'm running the movie. What are you trying to say?

I found thar the [jit.dimmap @map 1 0] sollution doesn't work as I expected.
What I want is to be able to read one line of the movie horizontally, and another line vertically.
Like outputting an entire line of a book page normally, and also to read the chinese way (the 1st line should coorrespond to the 1st letter of each line, the 2nd line coorresponds to the 2nd letter of each line, and so on).

The jit.dimmap distorts the matrix, and it's not an alternative solution for the message MODE.
Also, I'm still not able to make the MODE message to work in the chinese way of reading a book, only the normal way is working.

In the patch at the bottom, there are two slides near the jit.pwindow. The horizontal slide (that changes the vertical line) is working ok.
How to make the vertical slide (that should change the horizontal line) to work properly? From what I understand, it should work by sending [mode 1], but it doesn't. If works the same way as the horizontal slide.

Here's the changed patch.

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks in advance for any help given!

Bas van der Graaff's icon

I'm sorry i'm not making myself clear enough, I don't know how to explain this better...

- You don't need to rebang the movie because I already did that for you. It's the [t b] in the middle. Also, leaving the metro on will make sure it gets sent out always. Let's do that for now.
- [jit.dimmap] flips the axes of a matrix. Since it isn't square, sending it to a preview that is the same size as the horizontal will make it look strange, because it gets stretched.

Okay, I fixed the thing. I took out the mode so it would not distract you, as you still seem to have the impression it does something, while in this case, it doesn't. If you want to avoid the dimmap, you should play around with the srcdimstart and srcdimend of the bottom matrix, but this works too...

Max Patch
Copy patch and select New From Clipboard in Max.

ciperlone's icon

I guess I finally understand it!
My confusion was due to the multislider (and the distorted values of the jit.dimmap). After changing the sliders orientation to horizontal, I get that the analysis is working properly.
I just needed to check the analysis, so I could understand by practicing what I concluded by theory.

Thanks for all the clarification!!

But I still have some questions...
- Where's the trigger bang that you're talking about? I don't see any...
- What's the mode message for, and how to use it properly?

A huge thanks for being supportive, Bas
Jitter is not easy to understand, sometimes.

Bas van der Graaff's icon

- I removed the trigger bang from that latest version to clear things up.

- The mode message will make [jit.iter] read and send values from a matrix in a different order. Say your matrix looks like this:

[ 1 2 3 ]
[ 4 5 6 ]
[ 7 8 9 ]

normally, [jit.iter] will output 1, 2, 3, 4, 5, 6, 7, 8, 9. With mode 1, the output is this: 1, 4, 7, 2, 5, 8, 3, 6, 9. So it reads vertically. This may also make it clearer why reading a matrix like:

[ 1 2 3 4 5 6 7 8 9 ]

makes no difference when you turn on mode 1 (there is no vertical way to read it), which was the case in your earlier patch. Hope that clears thing up a little bit. Jitter does take time to get used to, don't give up...