Click here to Skip to main content
14,326,294 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am processing small images in an Application. For each pixel I need to store an integer between 40 and 90. I don't know how large the image is until runtime and in a session several images may be processed. I am thinking of using a datatable because it's easy but if an image is 400X500 that means adding 400 columns and 500 rows. A 3d array or list is good but the object needs to be public and resized after an image is loaded. A matrix is a possibility too. The big issue is resizing the object at runtime. I might write it out to a temp csv file and reload it when I need it. Suggestions please.

What I have tried:

Writing it out and arrays but can't resize public arrays at runtime
Posted
Updated 5 days ago

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

400 x 500 = 200,000.

Using 1 byte to store the "int" (cast as a byte), your "structure" is 200KB, which in my experience is trivial.

Even if you used "int", until you get to "multi-megabyte" structures, there's nothing to be concerned about.

Program first, tune later (within reason).
   
Comments
larry118 5 days ago
   
Are you saying I resize a 1 D array to 200,000 at th time?
larry118 3 days ago
   
It turns out the majority of processing time is taken up by drawing the grid around the characters not processing the image. I use drawline to draw the grid first vertical then horizontal.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100