Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON3. I need help with how I can count how many red channel numbers are in this .dat file. okay so i have 4 bins,

PYTHON3.

I need help with how I can count how many red channel numbers are in this .dat file.

okay so i have 4 bins, b1,b2,b3,b4. I don't understand how to read the value so i can then put all the red channel values between

Bin 1: 0 to 63

Bin 2: 64 to 127

Bin 3: 128 to 191

Bin 4: 192 to 255

and the same with green and blue channels.

How do I read the tuple in a certain spot and check. normally I would try color[0] for red and color[1]for green and color[2] for blue.

image text in transcribed

x hw1_hist_plotter.py O co van WN 10 11 12 2 Windows PowerShell (x86) C:\Users\Markudi devienvs cst205env\hw1_task1.py - Sublime Text (UNREGISTERED) 101, 36), (82, 104, 39), (86, 108, 43), (91, 113, 48), (94, 116, 51), (86, 108, 43), (84, : File Edit Selection Find View Goto Tools Project Preferences Help (94, 116, 51), (87, 109, 44), (82, 104, 39), (82, 104, 39), (90, 112, 40), (92, 114, 42), ( 5), (80, 101, 34), (82, 103, 38), (92, 113, 48), (98, 118, 55), (80, 100, 37), (88, 108, 45 testfile.py lab7task1.py x 4, 41), (93, 113, 50), (81, 101, 38), (71, 91, 28), (70, 91, 26), (73, 94, 27), (93, 114, 4 hw1_task1.py 18, 45), (85, 107, 34), (89, 111, 39), (86, 107, 38), (84, 105, 36), (84, 105, 36), (86, 10 1 import pickle 9, 111, 38), (88, 109, 40, (89, 110, 41), (92, 113, 44), (94, 115, 46), (93, 115, 43), (88 , (84, 106, 34), (88, 110, 38), (93, 114, 45), (88, 109, 40), (80, 101, 34), (87, 108, 41), 24), (72, 99, 30), (80, 105, 37), (82, 103, 36), (84, 103, 39), (77, 96, 32), (68, 87, 23), #variable to store data from image_matrix.dat 48), (80, 105, 40), (78, 103, 38), (83, 107, 45), (88, 110, 48), (87, 109, 47), (80, 100, 3 task1 = [] 43), (84, 103, 47), (78, 97, 41), (79, 98, 43), (80, 99, 44), (75, 93, 41), (76, 94, 42), ), (78, 98, 49), (82, 104, 55), (94, 116, 67), (92, 114, 65), (73, 92, 37), (78, 97, 42), ), (74, 94, 31), (76, 96, 33), (82, 102, 39), (77, 97, 36), (81, 101, 42), (82, 102, 43), O , (85, 105, 42), (98, 118, 55), (86, 106, 43), (84, 105, 40), (85, 106, 39), (84, 105, 36), task1 = pickle.load(open('image_matrix', 'rb')) 36), (80, 102, 37), (83, 105, 41), (84, 105, 46), (82, 103, 46), (80, 101, 44), (81, 102, 103, 44), (75, 95, 42), (77, 97, 44), (78, 98, 45), (81, 102, 46), (84, 105, 48), (80, 101, 7, 35), (78, 100, 38), (81, 103, 41), (79, 101, 39), (74, 96, 34), (78, 100, 38), (82, 104, 102, 47), (91, 109, 51), (90, 110, 49), (86, 106, 43), (81, 101, 38), (78, 100, 36), (79, 1 print(task1) , 97, 41), (79, 99, 46), (74, 94, 41), (72, 91, 36), (76, 95, 40), (79, 98, 42), (79, 98, 4 , 40), (90, 110, 47), (91, 112, 47), (83, 104, 39), (74, 94, 31), (73, 93, 32), (73, 93, 34 task1 41), (79, 98, 43), (82, 101, 46), (85, 104, 49), (76, 95, 40), (75, 94, 39), (76, 95, 39), I 2), (86, 109, 41), (86, 109, 39), (84, 107, 37), (78, 99, 30), (80, 101, 34), (82, 103, 36) 40), (82, 97, 38), (75, 95, 36), (78, 98, 39), (70, 89, 33), (68, 87, 31), (75. 94. 38). (6 (86, 106, 47), (87, 107, 46), (77, 97, 38), (73, 92, 36), (69, 87, 35), (62, 80, 30), (64, 7, 86, 40), (61, 78, 33), (69, 86, 41), (80, 98, 50), (74, 92, 44), (69, 87, 39), (78, 96, 16 , 36), (73, 90, 35), (76, 94, 36), (74, 92, 32), (73, 91, 29), (76, 94, 32), (82, 102, 39), red_bin1 = 0 44), (82, 101, 45), (81, 100, 45), (74, 92, 40), (65, 83, 33), (59, 77, 29), (65, 83, 35), ), (67, 85, 37), (69, 87, 37), (69, 87, 37), _(62, 82, 23), (67, 86, 30), (70, 89, 34), (69, 18 red bin2 = 0 2, 90, 40), (69, 87, 37), (73, 91, 39), (78, 97, 42), (78, 99, 42), (73, 94, 37), (68, 89, red bin3 = 0 , 46), (76, 94, 44), (72, 90, 38), (69, 87, 35), (70, 89, 34), (73, 94, 38), (73, 94, 38) 20 red bin4 = 0 , (68, 88, 39), (69, 89, 40), (71, 91, 42), (73, 91, 41), (73, 92, 37), (74, 93, 37), (74, #Red channel numbers , 97, 38), (72, 93, 36), (68, 89, 33), (68, 88, 35), (71, 91, 38), (72, 95, 43), (81, 101, 0, 37), (69, 88, 33), (71, 90, 35), (73, 92, 36), (73, 92, 36), (75, 93, 41), (73, 91, 39) for e in task1: ), (61, 79, 27), (64, 82, 30), (65, 83, 31), _(58, 76, 26), (55, 73, 23), (61, 81, 30), (69, 0, 90, 39), (70, 90, 39), (75, 93, 41), (77, 95, 43), (75, 94, 39), (71, 90, 35), (72, 91, if(task1[0] >= 0 and task1[0] = 64 and task1[0] = 128 and task1[0] = 192 and task1[') 31 red_bin4 = red bin4+1 if(task1[(0)] >= 0 and task1[(0)] =' not supported between instances of 'list' and 'int' O Line 30, Column 35 (cst205env) PS C:\Users\Markudi\devlenvs cst205env> T Determine what color is this RGB tuple - Stack Overflow Tab Size: - CRVoOoOITUOTTO x hw1_hist_plotter.py O co van WN 10 11 12 2 Windows PowerShell (x86) C:\Users\Markudi devienvs cst205env\hw1_task1.py - Sublime Text (UNREGISTERED) 101, 36), (82, 104, 39), (86, 108, 43), (91, 113, 48), (94, 116, 51), (86, 108, 43), (84, : File Edit Selection Find View Goto Tools Project Preferences Help (94, 116, 51), (87, 109, 44), (82, 104, 39), (82, 104, 39), (90, 112, 40), (92, 114, 42), ( 5), (80, 101, 34), (82, 103, 38), (92, 113, 48), (98, 118, 55), (80, 100, 37), (88, 108, 45 testfile.py lab7task1.py x 4, 41), (93, 113, 50), (81, 101, 38), (71, 91, 28), (70, 91, 26), (73, 94, 27), (93, 114, 4 hw1_task1.py 18, 45), (85, 107, 34), (89, 111, 39), (86, 107, 38), (84, 105, 36), (84, 105, 36), (86, 10 1 import pickle 9, 111, 38), (88, 109, 40, (89, 110, 41), (92, 113, 44), (94, 115, 46), (93, 115, 43), (88 , (84, 106, 34), (88, 110, 38), (93, 114, 45), (88, 109, 40), (80, 101, 34), (87, 108, 41), 24), (72, 99, 30), (80, 105, 37), (82, 103, 36), (84, 103, 39), (77, 96, 32), (68, 87, 23), #variable to store data from image_matrix.dat 48), (80, 105, 40), (78, 103, 38), (83, 107, 45), (88, 110, 48), (87, 109, 47), (80, 100, 3 task1 = [] 43), (84, 103, 47), (78, 97, 41), (79, 98, 43), (80, 99, 44), (75, 93, 41), (76, 94, 42), ), (78, 98, 49), (82, 104, 55), (94, 116, 67), (92, 114, 65), (73, 92, 37), (78, 97, 42), ), (74, 94, 31), (76, 96, 33), (82, 102, 39), (77, 97, 36), (81, 101, 42), (82, 102, 43), O , (85, 105, 42), (98, 118, 55), (86, 106, 43), (84, 105, 40), (85, 106, 39), (84, 105, 36), task1 = pickle.load(open('image_matrix', 'rb')) 36), (80, 102, 37), (83, 105, 41), (84, 105, 46), (82, 103, 46), (80, 101, 44), (81, 102, 103, 44), (75, 95, 42), (77, 97, 44), (78, 98, 45), (81, 102, 46), (84, 105, 48), (80, 101, 7, 35), (78, 100, 38), (81, 103, 41), (79, 101, 39), (74, 96, 34), (78, 100, 38), (82, 104, 102, 47), (91, 109, 51), (90, 110, 49), (86, 106, 43), (81, 101, 38), (78, 100, 36), (79, 1 print(task1) , 97, 41), (79, 99, 46), (74, 94, 41), (72, 91, 36), (76, 95, 40), (79, 98, 42), (79, 98, 4 , 40), (90, 110, 47), (91, 112, 47), (83, 104, 39), (74, 94, 31), (73, 93, 32), (73, 93, 34 task1 41), (79, 98, 43), (82, 101, 46), (85, 104, 49), (76, 95, 40), (75, 94, 39), (76, 95, 39), I 2), (86, 109, 41), (86, 109, 39), (84, 107, 37), (78, 99, 30), (80, 101, 34), (82, 103, 36) 40), (82, 97, 38), (75, 95, 36), (78, 98, 39), (70, 89, 33), (68, 87, 31), (75. 94. 38). (6 (86, 106, 47), (87, 107, 46), (77, 97, 38), (73, 92, 36), (69, 87, 35), (62, 80, 30), (64, 7, 86, 40), (61, 78, 33), (69, 86, 41), (80, 98, 50), (74, 92, 44), (69, 87, 39), (78, 96, 16 , 36), (73, 90, 35), (76, 94, 36), (74, 92, 32), (73, 91, 29), (76, 94, 32), (82, 102, 39), red_bin1 = 0 44), (82, 101, 45), (81, 100, 45), (74, 92, 40), (65, 83, 33), (59, 77, 29), (65, 83, 35), ), (67, 85, 37), (69, 87, 37), (69, 87, 37), _(62, 82, 23), (67, 86, 30), (70, 89, 34), (69, 18 red bin2 = 0 2, 90, 40), (69, 87, 37), (73, 91, 39), (78, 97, 42), (78, 99, 42), (73, 94, 37), (68, 89, red bin3 = 0 , 46), (76, 94, 44), (72, 90, 38), (69, 87, 35), (70, 89, 34), (73, 94, 38), (73, 94, 38) 20 red bin4 = 0 , (68, 88, 39), (69, 89, 40), (71, 91, 42), (73, 91, 41), (73, 92, 37), (74, 93, 37), (74, #Red channel numbers , 97, 38), (72, 93, 36), (68, 89, 33), (68, 88, 35), (71, 91, 38), (72, 95, 43), (81, 101, 0, 37), (69, 88, 33), (71, 90, 35), (73, 92, 36), (73, 92, 36), (75, 93, 41), (73, 91, 39) for e in task1: ), (61, 79, 27), (64, 82, 30), (65, 83, 31), _(58, 76, 26), (55, 73, 23), (61, 81, 30), (69, 0, 90, 39), (70, 90, 39), (75, 93, 41), (77, 95, 43), (75, 94, 39), (71, 90, 35), (72, 91, if(task1[0] >= 0 and task1[0] = 64 and task1[0] = 128 and task1[0] = 192 and task1[') 31 red_bin4 = red bin4+1 if(task1[(0)] >= 0 and task1[(0)] =' not supported between instances of 'list' and 'int' O Line 30, Column 35 (cst205env) PS C:\Users\Markudi\devlenvs cst205env> T Determine what color is this RGB tuple - Stack Overflow Tab Size: - CRVoOoOITUOTTO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions