Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mat indexer ignores 4th dimension #701

Open
Wouter1 opened this issue Aug 7, 2023 · 2 comments
Open

Mat indexer ignores 4th dimension #701

Wouter1 opened this issue Aug 7, 2023 · 2 comments

Comments

@Wouter1
Copy link

Wouter1 commented Aug 7, 2023

I create a 4dim matrix and then print the elements using createIndexer.toString()
code:

	public void testToString4D() {

		Mat mat = mat4d(5, 4, 2, 3);
		System.out.println(mat.createIndexer().toString());
	}

	private Mat mat4d(int s1, int s2, int s3, int s4) {
		int[] data = new int[s1 * s2 * s3 * s4];
		for (int n = 0; n < s1 * s2 * s3 * s4; n++)
			data[n] = n;
		Mat mat = new Mat(data).reshape(1, 4, new int[] { s1, s2, s3, s4 });
		return mat;
	}


It shows

[ (0.0, 3.0), (6.0, 9.0), (12.0, 15.0), (18.0, 21.0)
  (24.0, 27.0), (30.0, 33.0), (36.0, 39.0), (42.0, 45.0)
  (48.0, 51.0), (54.0, 57.0), (60.0, 63.0), (66.0, 69.0)
  (72.0, 75.0), (78.0, 81.0), (84.0, 87.0), (90.0, 93.0)
  (96.0, 99.0), (102.0, 105.0), (108.0, 111.0), (114.0, 117.0) ]

The deepest dimension is completely missing, instead it shows just a single double with what looks like the forst element of the deepest dimension

@Wouter1
Copy link
Author

Wouter1 commented Aug 7, 2023

This is with

		<dependency>
			<groupId>org.bytedeco</groupId>
			<artifactId>javacv-platform</artifactId>
			<version>1.5.8</version>
		</dependency>

@saudet
Copy link
Member

saudet commented Aug 7, 2023

Yes, Indexer.toString() needs to be improved. Contributions are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants