Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
4D matrices
#1
Hi guys. I recently switched from MATLAB to Python and the syntax is killing me a bit. I ran across this issue here

picture[:,:,:,j] = cv2.merge([image_b, image_g, image_r])
So in summary, I have a bunch of 3D matrices (colored images that I obtained from cv2.merge) and I want to append them all together such that I have a 4D matrix called "picture" where the last index of picture controls which image I see (image 1 is picture(:,:,:,1), image 2 is picture(:,:,:,2) and so on). Based on my experience with MATLAB and Python (so far) the line above should have achieved what I wanted, where the variable "j" is an index that changes inside a for loop. However, I keep getting an error that says "list indices must be integers or slices, not tuple". I hope someone can help.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to use Pauli Matrices in QNET Package Rupayan 2 1,922 Sep-25-2021, 06:02 AM
Last Post: Rupayan
  Python: Automated Script to Read Multiple Files in Respective Matrices Robotguy 7 4,238 Jul-03-2020, 01:34 AM
Last Post: bowlofred
  Application of dilute matrices chris_drak 0 1,351 Mar-29-2020, 03:04 PM
Last Post: chris_drak
  Partial "visual" Matching of matrices masteripper 15 5,312 Nov-03-2019, 05:41 PM
Last Post: masteripper
  Flipping matrices problem Qmohankumar0017 10 9,207 Feb-20-2019, 06:47 PM
Last Post: buran
  matrices math problem lokoprof 1 2,220 Aug-27-2018, 07:48 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020