1. Fernando Leal
  2. PowerBuilder
  3. Monday, 16 March 2020 13:52 PM UTC

How create two-dimensional arrays?

For example I try create 

byte lb_Array[25000, 25000]

The system does not respond, it is like it does not support this size.

What I'm doing is getting the number of bits that an image owns and looping through each bit in a for and the number of rows is greater than 24000.

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Monday, 16 March 2020 18:10 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Fernando - 

 

The syntax you provide is correct, however...

Are you expanding each bit in an image into one byte, or are you trying to manipulate the image content 8 bits at a time?

I'm not sure if there is a hard & fast limit, but a two-dimensional array containing 625,000,000 elements is likely exceeding the practical limit.

You may need to refactor your approach so that you work on only a small subset of the image elements (one or two lines, for example) at a time.

Regards, John

Comment
  1. Roland Smith
  2. Monday, 16 March 2020 18:13 PM UTC
Looping through with BlobMid would allow for analyzing it without having any arrays at all.



I'm wondering why this task is even needed. Depending on the requirements, a dedicated image processing component might be needed.
  1. Helpful
  1. Fernando Leal
  2. Monday, 16 March 2020 18:20 PM UTC
Thank you very much I have solved my problem, I was taking the information wrong.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Monday, 16 March 2020 19:30 PM UTC
  2. PowerBuilder
  3. # 1

Hi Fernando, I agree with John. Also note >>

Each variable in PB also has a NULL indicator. Not sure how much memory is allocated per NULL indicator. For each bit of memory for the NULL indicators you "lose" another 78 MB memory.

625 MB of raw image data is a LOT of image. At 32 bits/pixel it is 156+ megapixels.

(Remaining text: When I mention C# it might as well be any other programming language where you can do math without NULL handling)

PowerBuilder's data type for binary data en masse is BLOB.

PB code (forced to do NULL-checking for every calculation) will run slower than null-free image processing in C#.
C#'s data type byte [ ] is similar to PB's BLOB. And you have data types like Span<T> and immutable structs to do highly optimized image processing.

I suggest move image processing to a faster language (like C#) and pass data back and forth as appropriate.

HTH /Michael

Comment
There are no comments made yet.
Fernando Leal Accepted Answer Pending Moderation
  1. Monday, 16 March 2020 18:20 PM UTC
  2. PowerBuilder
  3. # 2

Thank you very much I have solved my problem, I was taking the information wrong.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.