Sathwikchowdary commited on
Commit
bf46c6b
·
verified ·
1 Parent(s): 1f95e93

Update pages/Info _of_Image.py

Browse files
Files changed (1) hide show
  1. pages/Info _of_Image.py +56 -611
pages/Info _of_Image.py CHANGED
@@ -23,620 +23,65 @@ custom_css = """
23
  p {
24
  color: #FFFFFF; /* White text for paragraphs */
25
  }
26
- .stButton>button {
27
- background-color: #4CAF50; /* Green */
28
- color: white;
29
- padding: 10px 24px;
30
- border: none;
31
- border-radius: 5px;
32
- text-align: center;
33
- font-size: 16px;
34
- margin: 4px 2px;
35
- transition-duration: 0.4s;
36
- cursor: pointer;
37
- }
38
- .stButton>button:hover {
39
- background-color: #45a049; /* Darker Green on hover */
40
- color: white;
41
- }
42
- .stButton>div:nth-child(1)>button {
43
- background-color: #2196F3; /* Blue */
44
- }
45
- .stButton>div:nth-child(2)>button {
46
- background-color: #f44336; /* Red */
47
- }
48
- .stButton>div:nth-child(3)>button {
49
- background-color: #FF9800; /* Orange */
50
- }
51
  </style>
52
  """
53
 
54
  # Inject the CSS into the app
55
- st.markdown("<div class='title'>Introduction to Image Data 📊</div>", unsafe_allow_html=True)
56
-
57
  st.markdown(
58
- """
59
- <div class="section">
60
- <div class="header">What is an Image?</div>
61
- <div class="content">An image is a visual representation of something, such as a person, object, scene, or concept.
62
- It can be created using various means and exists in different forms.<br>
63
- The image is a 2D grid like structure where every grid represents a pixel and each pixel has its own features. <br>
64
- The features in a pixel include theinformation like shape, color, pattern etc.<br>
65
- The clarity of an image directly depends on the number of pixels it has. <br>
66
- Every array cannot be an image. An array can be an image only when:<br>
67
- 1) It should be in 2D or 3D representation.<br>
68
- 2) The datatype should only be an integer.
69
- </div>
70
- </div>
71
- <div class="section">
72
- <div class="header">What are Color Spaces?</div>
73
- <div class="content">
74
- Color Space is a technique by which we can represent the colors of an image.<br>
75
- There are 3 types of color spaces namely:<br>
76
- 1) Black & White Color Space
77
- 2) Grayscale Color Space
78
- 3) RGB Color Space
79
- </div>
80
- </div>
81
- <div class="section">
82
- <div class="header">Black & White Color Space</div>
83
- <div class="content">
84
- In this Color Space, there are only 2 colors to represent the image which are black & white.<br>
85
- Here, 0 represents black and 1 represents white.
86
- </div>
87
- </div>
88
- <div class="section">
89
- <div class="header">Grayscale Color Space</div>
90
- <div class="content">
91
- In this Color Space, we have black, white and multiple shades of gray to represent the image.<br>
92
- Here, 0 represents black, 255 represents white, and 1 to 254 represent various shades of gray.
93
- </div>
94
- </div>
95
- <div class="section">
96
- <div class="header">RGB Color Space</div>
97
- <div class="content">
98
- In this Color Space, we create a 3D structure with three 2D channels namely blue, green and red channels
99
- where 0 represents absense of color and 255 represents presense of color.<br>
100
- These 3 channels are stacked one after the another like a layered structure.<br>
101
- The blue channel has 0 which represents black, 255 which represents blue and 1 to 254 represent multiple shades of blue.<br>
102
- The green channel has 0 which represents black, 255 which represents green and 1 to 254 represent multiple shades of green.<br>
103
- The red channel has 0 which represents black, 255 which represents red and 1 to 254 represent multiple shades of red.<br>
104
- </div><br><br>
105
- </div>
106
- """,
107
- unsafe_allow_html=True,
 
 
 
 
108
  )
109
- if st.button("Next Page: Basic operations on an Image"):
110
- st.session_state['page'] = 'image_operations'
111
-
112
- if page == 'image_operations':
113
- st.markdown("<div class='title'>Basic Operations on an Image</div>", unsafe_allow_html=True)
114
- st.markdown(
115
- """
116
- <div class="section">
117
- <div class="header">Operations on image data</div>
118
- <div class="content">There are 3 major operations which can be performed on an image namely:<br>
119
- 1) Reading an image<br>
120
- 2) Writing an image<br>
121
- 3) Showing an image
122
- </div>
123
- <div class="section">
124
- <div class="header">Reading an image</div>
125
- <div class="content">
126
- For this operation, we have to import <code>cv2</code> module and use the method <code>imread()</code>.
127
- The method <code>imread()</code> is used to convert an image file into a numpy array.
128
- </div>
129
- </div>
130
- <div class="section">
131
- <div class="header">Writing an image</div>
132
- <div class="content">
133
- For this operation, we have to import <code>cv2</code> module and use the method <code>imwrite()</code>.
134
- The method <code>imwrite()</code> is used to convert a numpy array back into an image file.
135
- </div>
136
- </div>
137
- <div class="section">
138
- <div class="header">Showing an image</div>
139
- <div class="content">
140
- For this operation, we have to import <code>cv2</code> module and use the method <code>imshow()</code>.
141
- The method <code>imshow()</code> is used to display an array in the form of an image by creating a popup window.
142
- </div>
143
- </div><br><br>
144
- """,
145
- unsafe_allow_html=True,
146
- )
147
- col1, col2 = st.columns(2)
148
- with col1:
149
- if st.button("Open Jupyter Notebook"):
150
- st.session_state['jupyter_clicked'] = True
151
- st.session_state['pdf_clicked'] = False
152
- with col2:
153
- if st.button("Open PDF"):
154
- st.session_state['pdf_clicked'] = True
155
- st.session_state['jupyter_clicked'] = False
156
-
157
- if st.session_state['jupyter_clicked']:
158
- st.markdown(
159
- """
160
- <div class="section">
161
- <div class="header">Jupyter Notebook for Basic Operations on an Image </div>
162
- <div class="content">This Jupyter notebook explains the basic operations that can be performed on an image.</div>
163
- </div>
164
- """,
165
- unsafe_allow_html=True,
166
- )
167
- # Embed the converted HTML file for the notebook
168
- notebook_html_path = "pages/basic_img_ops.html"
169
- with open(notebook_html_path, "r") as f:
170
- notebook_html = f.read()
171
- st.components.v1.html(notebook_html, height=500, scrolling=True)
172
-
173
- elif st.session_state['pdf_clicked']:
174
- st.markdown(
175
- """
176
- <div class="section">
177
- <div class="header">PDF file for Basic Operations on an Image</div>
178
- <div class="content">This PDFfile explains the basic operations that can be performed on an image.</div>
179
- </div>
180
- """,
181
- unsafe_allow_html=True,
182
- )
183
-
184
- pdf_path = "pages/basic_img_ops.pdf"
185
-
186
- # Read the PDF file content (binary data)
187
- with open(pdf_path, "rb") as file:
188
- pdf_data = file.read() # This is the binary data of the PDF file
189
-
190
- # Display the PDF in an iframe
191
- st.markdown(
192
- f'<iframe src="data:application/pdf;base64,{base64.b64encode(pdf_data).decode()}" width="100%" height="600px"></iframe>',
193
- unsafe_allow_html=True,
194
- )
195
-
196
- # Provide download option for the PDF file
197
- st.download_button(
198
- label="Download PDF",
199
- data=pdf_data, # Provide the binary file data here
200
- file_name="basic_img_ops.pdf", # This is the name that will appear when the user downloads the file
201
- mime="application/pdf"
202
- )
203
- if st.button("Next Page: Working on the Image"):
204
- st.session_state['page'] = 'image_working'
205
-
206
- elif page == 'image_working':
207
- st.markdown("<div class='title'>Working on the Image</div>", unsafe_allow_html=True)
208
- st.markdown(
209
- """
210
- <div class="section">
211
- <div class="header">Understanding split() method</div>
212
- <div class="content">
213
- For this operation, we have to import <code>cv2</code> module and use the method <code>split()</code>.<br><br>
214
- The <code>split()</code> method is used to separate a multi-channel image into its individual single-channel components.<br>
215
- </div>
216
- <div class="section">
217
- <div class="header">Understanding merge() method</div>
218
- <div class="content">
219
- For this operation, we have to import <code>cv2</code> module and use the method <code>merge()</code>.<br><br>
220
- The <code>merge()</code> method is used to combine multiple single-channel images into a single multi-channel image.<br><br>
221
- </div>
222
- </div><br><br>
223
- """,
224
- unsafe_allow_html=True,
225
- )
226
- col1, col2 = st.columns(2)
227
- with col1:
228
- if st.button("Open Jupyter Notebook"):
229
- st.session_state['jupyter_clicked'] = True
230
- st.session_state['pdf_clicked'] = False
231
- with col2:
232
- if st.button("Open PDF"):
233
- st.session_state['pdf_clicked'] = True
234
- st.session_state['jupyter_clicked'] = False
235
-
236
- if st.session_state['jupyter_clicked']:
237
- st.markdown(
238
- """
239
- <div class="section">
240
- <div class="header">Jupyter Notebook for Basic Operations on an Image </div>
241
- <div class="content">This Jupyter notebook explains the split and merge methods that can be performed on an image.</div>
242
- </div>
243
- """,
244
- unsafe_allow_html=True,
245
- )
246
- # Embed the converted HTML file for the notebook
247
- notebook_html_path = "pages/working_on_img.html"
248
- with open(notebook_html_path, "r") as f:
249
- notebook_html = f.read()
250
- st.components.v1.html(notebook_html, height=500, scrolling=True)
251
-
252
- elif st.session_state['pdf_clicked']:
253
- st.markdown(
254
- """
255
- <div class="section">
256
- <div class="header">PDF file for Basic Operations on an Image</div>
257
- <div class="content">This PDF file explains the split and merge methods that can be performed on an image.</div>
258
- </div>
259
- """,
260
- unsafe_allow_html=True,
261
- )
262
-
263
- pdf_path = "pages/working_on_img.pdf"
264
-
265
- # Read the PDF file content (binary data)
266
- with open(pdf_path, "rb") as file:
267
- pdf_data = file.read() # This is the binary data of the PDF file
268
-
269
- # Display the PDF in an iframe
270
- st.markdown(
271
- f'<iframe src="data:application/pdf;base64,{base64.b64encode(pdf_data).decode()}" width="100%" height="600px"></iframe>',
272
- unsafe_allow_html=True,
273
- )
274
-
275
- # Provide download option for the PDF file
276
- st.download_button(
277
- label="Download PDF",
278
- data=pdf_data, # Provide the binary file data here
279
- file_name="working_on_img.pdf", # This is the name that will appear when the user downloads the file
280
- mime="application/pdf"
281
- )
282
- if st.button("Next Page: Conversion between Color Spaces"):
283
- st.session_state['page'] = 'color_space_conversion_on_img'
284
-
285
- elif page == 'color_space_conversion_on_img':
286
- st.markdown("<div class='title'>Conversion between Color Spaces</div>", unsafe_allow_html=True)
287
- st.markdown(
288
- """
289
- <div class="section">
290
- <div class="header">How to convert one color space to another?</div>
291
- <div class="content">
292
- In the <code>cv2</code> module, we have an in-built method called <code>cvtColor()</code>
293
- along with in-built parameters for each conversion.<br><br>
294
- 1) For converting BGR to Grayscale,
295
- We use the parameter <code>COLOR_BGR2GRAY</code> inside the <code>cvtColor()</code> method.<br><br>
296
- 2) For converting Grayscale to BGR,
297
- We use the parameter <code>COLOR_GRAY2BGR</code> inside the <code>cvtColor()</code> method.<br><br>
298
- 3) For converting BGR to RGB,
299
- We use the parameter <code>COLOR_BGR2RGB</code> inside the <code>cvtColor()</code> method.<br><br>
300
- </div>
301
- </div><br><br>
302
- """,
303
- unsafe_allow_html=True,
304
- )
305
- col1, col2 = st.columns(2)
306
- with col1:
307
- if st.button("Open Jupyter Notebook"):
308
- st.session_state['jupyter_clicked'] = True
309
- st.session_state['pdf_clicked'] = False
310
- with col2:
311
- if st.button("Open PDF"):
312
- st.session_state['pdf_clicked'] = True
313
- st.session_state['jupyter_clicked'] = False
314
-
315
- if st.session_state['jupyter_clicked']:
316
- st.markdown(
317
- """
318
- <div class="section">
319
- <div class="header">Jupyter Notebook for Basic Operations on an Image </div>
320
- <div class="content">This Jupyter notebook explains the split and merge methods that can be performed on an image.</div>
321
- </div>
322
- """,
323
- unsafe_allow_html=True,
324
- )
325
- # Embed the converted HTML file for the notebook
326
- notebook_html_path = "pages/converting_color_spaces.html"
327
- with open(notebook_html_path, "r") as f:
328
- notebook_html = f.read()
329
- st.components.v1.html(notebook_html, height=500, scrolling=True)
330
-
331
- elif st.session_state['pdf_clicked']:
332
- st.markdown(
333
- """
334
- <div class="section">
335
- <div class="header">PDF file for Basic Operations on an Image</div>
336
- <div class="content">This PDF file explains the split and merge methods that can be performed on an image.</div>
337
- </div>
338
- """,
339
- unsafe_allow_html=True,
340
- )
341
-
342
- pdf_path = "pages/converting_color_spaces.pdf"
343
-
344
- # Read the PDF file content (binary data)
345
- with open(pdf_path, "rb") as file:
346
- pdf_data = file.read() # This is the binary data of the PDF file
347
-
348
- # Display the PDF in an iframe
349
- st.markdown(
350
- f'<iframe src="data:application/pdf;base64,{base64.b64encode(pdf_data).decode()}" width="100%" height="600px"></iframe>',
351
- unsafe_allow_html=True,
352
- )
353
-
354
- # Provide download option for the PDF file
355
- st.download_button(
356
- label="Download PDF",
357
- data=pdf_data, # Provide the binary file data here
358
- file_name="converting_color_spaces.pdf", # This is the name that will appear when the user downloads the file
359
- mime="application/pdf"
360
- )
361
- if st.button("Next Page: Affine Transformations on an Image"):
362
- st.session_state['page'] = 'affine_transformations'
363
-
364
- elif page == 'affine_transformations':
365
- st.markdown("<div class='title'>Affine Transformations on an Image</div>", unsafe_allow_html=True)
366
- st.markdown(
367
- """
368
- <div class="section">
369
- <div class="header">What are Affine Transformations?</div>
370
- <div class="content">
371
- Affine Transformations are a part of Image augmentation.<br>
372
- Image augmentation is a technique of creating new images from the existing images.<br>
373
- This technique is used to create a balance in the dataset.<br>
374
- For a particular label, ff there are less images compared to the other label,
375
- we increase the no. of images in that label using Image augmentation.<br><br>
376
- Advantages of Affine Transformations include:<br>
377
- 1) We convert our imbalanced data into balanced data.<br>
378
- 2) We get new images from old ones<br><br>
379
- </div>
380
- <div class="header">Types of Affine Transformations?</div>
381
- <div class="content">
382
- There are 5 types of Affine Transformations namely:<br>
383
- 1) Translation<br>
384
- 2) Rotation<br>
385
- 3) Scaling<br>
386
- 4) Shearing<br>
387
- 5) Cropping<br><br>
388
- </div>
389
- <div class="header">Translation</div>
390
- <div class="content">
391
- It is a technique of shifting the image by some bits on the X-axis and the Y-axis.<br>
392
- The extra bits created are replaced with black color or duplicate pixels.<br>
393
- We apply a Translation matrix ( Tm ) for this.<br>
394
- </div>
395
- <div class="header">Rotation</div>
396
- <div class="content">
397
- It is a technique of rotating the image by at an angle from the specified position.<br>
398
- We apply a Rotation matrix ( Rm ) for this.<br>
399
- We can use a combination of Rotation & Translation in the same Rotation matrix ( Rm )<br>
400
- </div>
401
- <div class="header">Scaling</div>
402
- <div class="content">
403
- It is a technique of increasing or decreasing the size of the image by a particular scale.<br>
404
- We apply a Scaling matrix ( Sm ) for this.<br>
405
- We can use a combination of Scaling & Translation in the same Scaling matrix ( Sm )<br>
406
- </div>
407
- <div class="header">Shearing</div>
408
- <div class="content">
409
- It is a technique of stretching the image from its edges by a particular value.<br>
410
- We apply a Shearing matrix ( Shm ) for this.<br>
411
- We can use a combination of Shearing, Scaling & Translation in the same Shearing matrix ( Shm )<br>
412
- </div>
413
- <div class="header">Cropping</div>
414
- <div class="content">
415
- It is a technique of extracting or cutting a part of the image from the original image.<br>
416
- We don't have a cropping matrix for this technique.<br>
417
- Instead, we have to do it manually using slicing operation on the Numpy array.<br>
418
- </div>
419
- </div><br><br>
420
- """,
421
- unsafe_allow_html=True,
422
- )
423
- col1, col2 = st.columns(2)
424
- with col1:
425
- if st.button("Open Jupyter Notebook"):
426
- st.session_state['jupyter_clicked'] = True
427
- st.session_state['pdf_clicked'] = False
428
- with col2:
429
- if st.button("Open PDF"):
430
- st.session_state['pdf_clicked'] = True
431
- st.session_state['jupyter_clicked'] = False
432
-
433
- if st.session_state['jupyter_clicked']:
434
- st.markdown(
435
- """
436
- <div class="section">
437
- <div class="header">Jupyter Notebook for Basic Operations on an Image </div>
438
- <div class="content">This Jupyter notebook explains all the affine transformations that can be performed on an image.</div>
439
- </div>
440
- """,
441
- unsafe_allow_html=True,
442
- )
443
- # Embed the converted HTML file for the notebook
444
- notebook_html_path = "pages/affine_transformations.html"
445
- with open(notebook_html_path, "r") as f:
446
- notebook_html = f.read()
447
- st.components.v1.html(notebook_html, height=500, scrolling=True)
448
-
449
- elif st.session_state['pdf_clicked']:
450
- st.markdown(
451
- """
452
- <div class="section">
453
- <div class="header">PDF file for Basic Operations on an Image</div>
454
- <div class="content">This PDF file explains all the affine transformations that can be performed on an image.</div>
455
- </div>
456
- """,
457
- unsafe_allow_html=True,
458
- )
459
-
460
- pdf_path = "pages/affine_transformations.pdf"
461
-
462
- # Read the PDF file content (binary data)
463
- with open(pdf_path, "rb") as file:
464
- pdf_data = file.read() # This is the binary data of the PDF file
465
-
466
- # Display the PDF in an iframe
467
- st.markdown(
468
- f'<iframe src="data:application/pdf;base64,{base64.b64encode(pdf_data).decode()}" width="100%" height="600px"></iframe>',
469
- unsafe_allow_html=True,
470
- )
471
-
472
- # Provide download option for the PDF file
473
- st.download_button(
474
- label="Download PDF",
475
- data=pdf_data, # Provide the binary file data here
476
- file_name="affine_transformations.pdf", # This is the name that will appear when the user downloads the file
477
- mime="application/pdf"
478
- )
479
- if st.button("Next Page: Handling Video Data"):
480
- st.session_state['page'] = 'video_data'
481
-
482
- elif page == 'video_data':
483
- st.markdown("<div class='title'>Handling Video Data</div>", unsafe_allow_html=True)
484
- st.markdown(
485
- """
486
- <div class="section">
487
- <div class="header">What is a Video?</div>
488
- <div class="content">
489
- A video is a sequence of images, called frames, displayed rapidly one after another to create the illusion of motion.<br><br>
490
- To deal with the video data, we import the <code>cv2</code> module and use the <code>VideoCapture()</code> method.<br><br>
491
- <code>VideoCapture()</code> method is used to converts a video into list of frames.<br><br>
492
- </div>
493
- <div class="header">Playing the Video</div>
494
- <div class="content">
495
- If we specify a path inside <code>VideoCapture()</code> method, it reads the particular video.<br><br>
496
- </div>
497
- <div class="header">Live Video capturing</div>
498
- <div class="content">
499
- If we assign 0 inside the <code>VideoCapture()</code> method, it open the Web camera for live video capturing.<br><br>
500
- </div><br><br>
501
- """,
502
- unsafe_allow_html=True,
503
- )
504
- col1, col2 = st.columns(2)
505
- with col1:
506
- if st.button("Open Jupyter Notebook"):
507
- st.session_state['jupyter_clicked'] = True
508
- st.session_state['pdf_clicked'] = False
509
- with col2:
510
- if st.button("Open PDF"):
511
- st.session_state['pdf_clicked'] = True
512
- st.session_state['jupyter_clicked'] = False
513
-
514
- if st.session_state['jupyter_clicked']:
515
- st.markdown(
516
- """
517
- <div class="section">
518
- <div class="header">Jupyter Notebook for Basic Operations on an Image </div>
519
- <div class="content">This Jupyter notebook explains how to handle video data.</div>
520
- </div>
521
- """,
522
- unsafe_allow_html=True,
523
- )
524
- # Embed the converted HTML file for the notebook
525
- notebook_html_path = "pages/handling_video_data.html"
526
- with open(notebook_html_path, "r") as f:
527
- notebook_html = f.read()
528
- st.components.v1.html(notebook_html, height=500, scrolling=True)
529
-
530
- elif st.session_state['pdf_clicked']:
531
- st.markdown(
532
- """
533
- <div class="section">
534
- <div class="header">PDF file for Basic Operations on an Image</div>
535
- <div class="content">This PDF file explains how to handle video data.</div>
536
- </div>
537
- """,
538
- unsafe_allow_html=True,
539
- )
540
-
541
- pdf_path = "pages/handling_video_data.pdf"
542
-
543
- # Read the PDF file content (binary data)
544
- with open(pdf_path, "rb") as file:
545
- pdf_data = file.read() # This is the binary data of the PDF file
546
-
547
- # Display the PDF in an iframe
548
- st.markdown(
549
- f'<iframe src="data:application/pdf;base64,{base64.b64encode(pdf_data).decode()}" width="100%" height="600px"></iframe>',
550
- unsafe_allow_html=True,
551
- )
552
-
553
- # Provide download option for the PDF file
554
- st.download_button(
555
- label="Download PDF",
556
- data=pdf_data, # Provide the binary file data here
557
- file_name="handling_video_data.pdf", # This is the name that will appear when the user downloads the file
558
- mime="application/pdf"
559
- )
560
- if st.button("Next Page: Interesting projects on Image & Video data"):
561
- st.session_state['page'] = 'projects'
562
-
563
- elif page == 'projects':
564
- st.markdown("<div class='title'>🎥✨ Interesting Projects on Image & Video Data 🌟🖼️</div>", unsafe_allow_html=True)
565
- st.markdown(
566
- """
567
- <div class="section">
568
- <div class="header">Converting an Image into Tabular data</div>
569
- <div class="content">
570
- This amazing project explains how we can convert an image into tabular data. Check this out below 👇
571
- <br>
572
- </div>
573
- </div><br>
574
- """,
575
- unsafe_allow_html=True,
576
- )
577
- if st.button("Go to Project 1"):
578
- js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/converting_image_into_tabular_data.ipynb')"
579
- st.components.v1.html(f"<script>{js}</script>", height=0)
580
- st.markdown(
581
- """
582
- <div class="section">
583
- <div class="header">Converting a Video into Tabular data</div>
584
- <div class="content">
585
- This amazing project explains how we can convert a video into tabular data. Check this out below 👇
586
- <br>
587
- </div>
588
- </div><br>
589
- """,
590
- unsafe_allow_html=True,
591
- )
592
- if st.button("Go to Project 2"):
593
- js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/converting_videos_into_tabular_data.ipynb')"
594
- st.components.v1.html(f"<script>{js}</script>", height=0)
595
- st.markdown(
596
- """
597
- <div class="section">
598
- <div class="header">Animation Project</div>
599
- <div class="content">
600
- This amazing project explains how we can create interesting Animation videos using OpenCV package. Check this out below 👇
601
- <br>
602
- </div>
603
- </div><br>
604
- """,
605
- unsafe_allow_html=True,
606
- )
607
- if st.button("Go to Project 3"):
608
- js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/animation_project_opencv.ipynb')"
609
- st.components.v1.html(f"<script>{js}</script>", height=0)
610
- st.markdown(
611
- """
612
- <div class="section">
613
- <div class="header">GIF Project</div>
614
- <div class="content">
615
- This amazing project explains how we can create an interesting GIF using OpenCV package. Check this out below 👇
616
- <br>
617
- </div>
618
- </div><br>
619
- """,
620
- unsafe_allow_html=True,
621
- )
622
- if st.button("Go to Project 4"):
623
- js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/GIF_project.ipynb')"
624
- st.components.v1.html(f"<script>{js}</script>", height=0)
625
- st.markdown(
626
- """
627
- <div class="section">
628
- <div class="header">Cropping Tool</div>
629
- <div class="content">
630
- This amazing project explains how we can create an interesting GIF using OpenCV package. Check this out below 👇
631
- <br>
632
- </div>
633
- </div><br>
634
- """,
635
- unsafe_allow_html=True,
636
- )
637
- if st.button("Go to Project 5"):
638
- js = "window.open('https://github.com/ChaitanyaSubhakar/Handling-Image-and-Video/blob/main/cropping_tool.ipynb')"
639
- st.components.v1.html(f"<script>{js}</script>", height=0)
640
- if st.button("Return to main page.."):
641
- st.session_state['page'] = 'unstructured_data'
642
-
 
23
  p {
24
  color: #FFFFFF; /* White text for paragraphs */
25
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  </style>
27
  """
28
 
29
  # Inject the CSS into the app
30
+ st.markdown(custom_css, unsafe_allow_html=True)
31
+ st.markdown("<h2 style='text-align: left; color: Black;'>What is IMAGE</h2>", unsafe_allow_html=True)
32
  st.markdown(
33
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
34
+ "An image is a visual depiction of a subject, such as a person, object, scene, or idea, created or captured through means like photography, drawing, painting, or digital tools. It can take various forms, including photographs, illustrations, artworks, or computer-generated visuals."
35
+ "</p>",
36
+ unsafe_allow_html=True
37
+ )
38
+ st.markdown("<h2 style='text-align: left; color: Black;'>Features of IMAGE</h2>", unsafe_allow_html=True)
39
+ st.markdown(
40
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
41
+ "Pixels: Images are composed of small dots called pixels, each containing color data that together create the overall image."
42
+ "</p>",
43
+ unsafe_allow_html=True
44
+ )
45
+ st.markdown(
46
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
47
+ "File Formats: Images can be stored in different formats,"
48
+ "JPEG/JPG: Widely used for photographs and online images due to their efficient balance between quality and file size."
49
+ "PNG: Preferred for high-quality visuals or images requiring transparency, such as logos."
50
+ "GIF: Commonly utilized for basic animations or compact graphics."
51
+ "</p>",
52
+ unsafe_allow_html=True
53
+ )
54
+ st.markdown("<h2 style='text-align: left; color: Black;'>Basic Operations in IMAGE</h2>", unsafe_allow_html=True)
55
+ st.markdown(
56
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
57
+ "For performing this Basic Operations we use cv2 function from opencv library"
58
+ "cv2 is the Python module for OpenCV (Open Source Computer Vision Library), a powerful library used for computer vision and image processing tasks. It provides a wide range of tools and algorithms for analyzing and manipulating images and videos."
59
+ "</p>",
60
+ unsafe_allow_html=True
61
+ )
62
+ st.markdown("<h3 style='text-align: left; color: Black;'>Why cv2 is Used</h3>", unsafe_allow_html=True)
63
+ st.markdown(
64
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
65
+ "cv2 is used for various ways like:"
66
+ "1.Image Processing"
67
+ "2.Video Analysis"
68
+ "3.Feature Detection"
69
+ "4.Image Transformations"
70
+ "</p>",
71
+ unsafe_allow_html=True
72
+ )
73
+ st.markdown("<h3 style='text-align: left; color: Black;'>Operations Used</h3>", unsafe_allow_html=True)
74
+ st.markdown("1.imread()")
75
+ st.markdown("2.imshow()")
76
+ st.markdown("3.imwrite()")
77
+ st.markdown("4.cv2.waitkey()")
78
+ st.markdown("5.destroyallwindows()")
79
+
80
+ # Add a link to the code
81
+ st.markdown(
82
+ "<p style='font-size: 16px; color: White;'>"
83
+ "You can view and run the code in Colab: "
84
+ "<a href='https://colab.research.google.com/drive/1fvP-k70HJnp1iCN7Vs-tkfFs8vq--WGc?usp=sharing' target='_blank' style='color: #FFD700;'>Colab Notebook</a>"
85
+ "</p>",
86
+ unsafe_allow_html=True
87
  )