Skip to content
  • Home
  • Resources
    • Resource List
  • STEM Courses
    • STEM Educators
    • за STEM образователни работници
    • Professores STEM
    • Educatori STEM
    • εκπαιδευτές STEM
    • За STEM едукатори
    • All Courses
  • STEM Community Hubs
    • STEM in Cyprus
    • STEM in Lithuania
    • STEM in Greece
    • STEM in Italy
    • STEM in Portugal
    • STEM in North Macedonia
    • STEM in Bulgaria
  • Login
  • Register
  • Contacts
  • en_GBEnglish (UK)
    • elΕλληνικά
    • mk_MKМакедонски јазик
    • it_ITItaliano
    • pt_PTPortuguês
    • bg_BGБългарски
    • lt_LTLietuvių kalba
Menu
  • Home
  • Resources
    • Resource List
  • STEM Courses
    • STEM Educators
    • за STEM образователни работници
    • Professores STEM
    • Educatori STEM
    • εκπαιδευτές STEM
    • За STEM едукатори
    • All Courses
  • STEM Community Hubs
    • STEM in Cyprus
    • STEM in Lithuania
    • STEM in Greece
    • STEM in Italy
    • STEM in Portugal
    • STEM in North Macedonia
    • STEM in Bulgaria
  • Login
  • Register
  • Contacts
  • en_GBEnglish (UK)
    • elΕλληνικά
    • mk_MKМакедонски јазик
    • it_ITItaliano
    • pt_PTPortuguês
    • bg_BGБългарски
    • lt_LTLietuvių kalba
Resource

Image processing using MATLAB

Print Resource
  • Resource Information

Abstract

This is fun project based on image processing with MATLAB, here we will come accross learing how to count the number of distinguishable objects in an image. The following tutorial is performed with the help of MATLAB. MATLAB stands for “MATrix LABoratory” and is a numerical computing environment and fourth-generation programming language, developed by MathWorks. Using MATLAB, we can solve technical computing problems faster than with traditional programming languages, such as C, C++, and Fortran. This activity can be developed individually by learners or as a pair activity (2 learners) that shall be focused on the use of MATLAB. Teacher shall maintain a close screw of the work performed by the learners. The tutorial can be performed by executing the commands in each step sequentially in the command window of MATLAB.

An original image

Source https://www.instructables.com/Image-Processing-and-Counting-using-MATLAB/

Learning Outcomes

The learners will learn how to edit an image using MATLAB.

  • Organize a teamwork by dividing tasks and roles.
  • Social skills such as leadership, organizational conscience or communication.
  • Programming skills.
  • Management of time and resources in order to fulfil the proposed objectives.
  • Social responsibility and awareness.
  • Mathematical knowledge by recognizing different measures, volumes and perspectives.
  • How to work in group.
  • How to understand programming principles.
  • How to process an image using MATLAB.

Other Instructions

In 7 simple steps you will have your processed image: o Read an image: An image is choosen so that it has considerable contrast with its background so that the objects can be identified. The function imread reads the image from a given location and stores it in the matrix img1. The imshow function displays the image. img1=imread(‘Lines.jpg’); imshow(img1) o Convert to greyscale: This step removes any color information in the image to make it easier to identify objects. The rgb2gray converts the color image into a grayscale image and stores it into the matrix img2. img1=rgb2gray(img1); imshow(img1) o Threshold the image: This step thresholds the image by converting the grayscale image into an image that contains only two colors. The function im2bw() assigns black color to all the pixels that have luminosity than a threshold level and the others as white. the function graythresh() approximately calculates the threshold of the image. img2=im2bw(img1,graythresh(img1)); imshow(img2) o Complement the image: In this step we complement the image by using the ~ operator. By this we convert the white patches into black and vice versa. We perform this step as we wanted the areas of concern(objects) to be colored white. img2=~img2; imshow(img2) o Found the boundaries of the object: This step finds the boundaries of each object that it finds and stores it in B. The text function prints the number of objects that are found by bwboundaries. B = bwboundaries(img2); imshow(img2) text(10,10,strcat(‘\color{green}Objects Found:’,num2str(length(B)))) hold on o Draw the boundaries: This is a fun step in which we mark the boundaries of all the objects identified by bwboundaries function. This step can be eliminated if it seems complicated for k = 1:length(B) boundary = B{k}; plot(boundary(:,2), boundary(:,1), ‘g’, ‘LineWidth’, 0.2) end

URL

RESOURCES

Author

Christina Taka
Christina Taka

Language

English

Main Topics

Arts, Science, Technology

Keywords

image processing MATLAB programming

The European Commission support for the production of this publication does not constitute an endorsement of the contents which reflects the views only of the authors, and the Commission cannot be held responsi­ble for any use which may be made of the information contained therein.

Copyright © 2022 SAPPHIRE • All rights reserved

SAPPHIRE Website
en_GBEnglish (UK)
bg_BGБългарски pt_PTPortuguês it_ITItaliano lt_LTLietuvių kalba mk_MKМакедонски јазик elΕλληνικά en_GBEnglish (UK)