.st0{fill:#FFFFFF;}

Image Processing Using Fuzzy Logic Toolbox 

 August 31, 2020

By  MayuriParkhe

Have you ever imagined how our facial patterns are recognized; or how the antiskid braking system works; all these are put into the application using Fuzzy logic toolbox, because of its computational perception properties. It deals with information that arises from cognition, that is, uncertain or imprecise or vague depending upon the situation. It gives us a broader view of a more in-depth analysis, which provides us a better assessment of options.

Fuzzy logic toolbox – An Introduction

Fuzzy logic has two different meanings. In a narrow sense, fuzzy logic is a logical system, which is an extension of multivalued logic. However, in the broader sense, Fuzzy Logic (FL) is almost synonymous with the theory of fuzzy sets. This theory relates to classes of objects with unsharp boundaries in which membership is a matter of degree.

Fuzzy Logic Toolbox provides us with functions, apps, and blocks of Simulink, which are used for analyzing, designing, and simulating systems based on fuzzy logic. This toolbox guides us through the steps of designing fuzzy inference systems. In its functions are provided for many standard methods, including fuzzy clustering and adaptive neuro-fuzzy learning.

This toolbox lets us model complex system behaviors using simple logic rules, and then implement these rules in a fuzzy inference system. We can use it as a stand-alone fuzzy inference engine. Alternatively, we can use fuzzy inference blocks in Simulink and simulate the fuzzy systems within a comprehensive model of the entire dynamic system.

Fuzzy Inference system

The fuzzy inference system can be referred to as the critical unit of the fuzzy logic system. Its primary function is based upon decision making. The rules which it follows is "IF <_condition_>THEN", which is connected through "OR" or "AND".

Let's take an example, if one condition is satisfied, then the rule is applicable. Now take the example of two rules which are applicable or suppose two situations are applicable, and you must draw the decision, keeping in mind both. Here the work of connectors come. We will be using connectors for implementing 2 rules or conditions simultaneously.

Now let's have an overview of the functional blocks of the Fuzzy Inference System.

Rule Base – It contains a different set of rules. The rules are generally IF-THEN based.

Database – It defines the fuzzy sets by defining the membership functions. These fuzzy sets are used in fuzzy rules.

Decision-making Unit – Perform different operations on the rules and provide us the decisions.

Fuzzification interface unit – its purpose is to convert the crisp input quantities into fuzzy quantities. The input that we will be provided to the inference system, the fuzzification unit will convert that into fuzzy quantities.

Defuzzification interface unit – it converts the fuzzy quantities into crisp quantities because, at the end of the process, some numerical value is required, and for that purpose, we need this conversion.

functional_block

Block diagram representing all the functional blocks involved

Working of the fuzzy inference system

  • A fuzzification unit supports the application of numerous fuzzification methods and converts the crisp input into fuzzy input.
  • A Knowledge Base – Collection of rule base and database is formed upon the conversion of crisp input into fuzzy input.
  • The defuzzification unit – Fuzzy input is finally converted into crisp input.

Methods involved in Fuzzy inference system

The Fuzzy inference methods are classified into two major categories, direct methods and indirect methods. The Direct methods include the Mamdani method and Takagi and Sugeno methods which are the most used. We encounter a difference between the two while obtaining the output. Indirect methods have proven to be tricky.

types_of_methods

The two methods involved in the fuzzy logic toolbox: Direct and Indirect methods

There are 2 crucial methods of fuzzy inference system, having different fuzzy rules. They are

  • Mamdani Fuzzy Inference system

  • Takagi-Sugeno Fuzzy Model (TS Method)

Now let's understand each of the methods involved in details.

Mamdani Fuzzy Inference System

This system was proposed in 1975 by Ebhasim Mamdani, so it got its name from it. It is commonly used in applications, like controlling a steam engine and boiler combination by synthesizing a set of fuzzy rules obtained from the people working on the system due to its simple structure of 'min-max' operations.

We will now go through the steps involved in the process. For this, we will consider a real-life example of giving tips for the service received at a restaurant. Based on this, we give a rating between 0 and 10 that represents the quality of service at a restaurant, which helps in evaluating the results.

Evaluating the antecedent for each rule.

Through our input values (crisp values), we obtain their membership values. This process is termed as input fuzzification. If the antecedent of the rule has more than one part, a fuzzy operator (t-norm or t-conorm) is applied to obtain a single membership value.

Step1

Input Fuzzification

When fuzzifying initially, the antecedent (service is excellent) we obtain the rating to which the service is excellent. For example, if we rate it as 3 (which gives a wrong impression when measured according to the highest limit, 10), which means that the service provided is low as a result, we obtain membership function as 0. In the second part of the antecedent (food is delicious), if we rate it as 8 (which gives a good impression when measured according to the highest limit, 10), which means that the service provided is suitable as a result, we obtain membership function as 0.7.

Now we can see that the 2 statements are joined by a "OR" (service is excellent, or food is delicious), we apply OR operation. A decision is made that is any of the conditions is satisfied, we obtain the membership function. This gives the maximum value as a result

Suppose if it was joined by "AND" then the membership function obtained would have been the minimum.

Obtaining the conclusion of each rule applied

From the result that we obtained from step 1 by evaluating the antecedents, we now apply a fuzzy implication operator to obtain a new fuzzy set for the further process.

Step2

Obtaining the conclusion of each rule applied

By using the minimum operator, we can scale down the output received.

Summing up the conclusions

In this step, we will be combining all the outputs for the rules specified in the previous step, into a fuzzy set. This will be done using the fuzzy aggregation operator.

Examples of some aggregation operators are:

  • The Maximum

  • The Sum

  • The Probabilistic sum

Step3

Summing up the conclusions

Defuzzification

While solving any decision-based problem, we want the answer in numeric form or crisp values instead of a fuzzy set.

Like considering the above example, we want to know the number of tips which we want to give for the services received instead of knowing the quality of tips. For this, we transform our fuzzy set, which we obtained in the above example into a numeric value. So, for every Mamdani, some simple steps are to be followed, which are as:

Step 1.

We must determine the fuzzy rules involved.

Step 2.

By using the input membership functions, we will be making the input values or crisp quantities fuzzy

Step 3.

In this step, we will be establishing the rule strength by combining the fuzzified inputs according to the fuzzy rules.

Step 4.

Now the process will go to the other part; that is the consequence, and previously, we were dealing with the antecedent. We will determine the consequences of rule by combining the rule strength and the output membership function.

Step 5.

For getting the output distribution, combine all the consequences. From this, we obtained the defuzzified output distribution is obtained.

Defuzzification

After the fuzzification process is done and we receive our output, but the output received is in the form of a fuzzy set and not in numeric or crisp quantities. So, for this, we need to transform the fuzzy set into numeric value or crisp quantities.

For this purpose, we use the defuzzification process called the centroid.Through the process pf centroid, we obtain the center value of the output received in the aggregation process

Reasons why fuzzy logic is efficient to use

  • Fuzzy logic helps in solving the day to day life situations.
  • The concepts involved are straightforward to understand and implement.
  • It is quite flexible, as it is effortless to modify. We can modify the fuzzy inference system (FIS) just by editing the rules, and there is no need for the creation of other FIS of the same purpose.
  • Its flexibility is extended as it can be integrated into other classic control techniques.

Examples where fuzzy logic is used

Product

Company

Fuzzy Logic

Anti-lock brakes

Nissan

Use fuzzy logic to controls brakes in hazardous cases depend on car speed, acceleration, wheel speed, and acceleration

Auto transmission

NOK/Nissan

Fuzzy logic is used to control the fuel injection and ignition based on throttle setting, cooling water temperature, RPM, etc.

Auto engine

Honda, Nissan

Use to select gear based on engine load, driving style, and road conditions.

Copy machine

Canon

Using for adjusting drum voltage based on picture density, humidity, and temperature.

Cruise control

Nissan, Isuzu, Mitsubishi

Use it to adjusts throttle setting to set car speed and acceleration

Dishwasher

Matsushita

Use for adjusting the cleaning cycle, rinse and wash strategies based depend upon the number of dishes and the amount of food served on the dishes.

Elevator control

Fujitec, Mitsubishi Electric, Toshiba

Use it to reduce waiting for time-based on passenger traffic

Golf diagnostic system

Maruman Golf

Selects a golf club based on golfer’s swing and physique.

Fitness management

Omron

Fuzzy rules are implied by them to check the fitness of their employees.

Kiln control

Nippon Steel

Mixes cement

Microwave oven

Mitsubishi Chemical

Sets lunes power and cooking strategy

Palmtop computer

Hitachi, Sharp, Sanyo, Toshiba

Recognizes handwritten Kanji characters

Plasma etching

Mitsubishi Electric

Sets etch time and strategy

Fuzzy Logic Designer

For designing our fuzzy inference systems, we must either use the Fuzzy Logic Designer App or the commands. For better results, we can specify the Input and Output membership functions.

Get Access to
Codes & Report!

Learn to implement Fuzzy Logic for Image Processing techniques like edge detection, noise reduction, image segmentation, etc.; Developed in MATLAB R2019a with Fuzzy Logic Designer Toolbox.

Image Processing using Fuzzy Logic

First, let us understand what image processing means that it is a process to perform specific techniques on an image, to get an enhanced image, or to extract some useful information from it. We can even consider it as a type of signal processing in which input is an image, and output may be image or characteristics/features associated with that image.

In Image processing, the techniques involved use filters to enhance an image. Their main applications are to transform the contrast, brightness, resolution, and noise level of an image.

Now moving on to Image processing using Fuzzy Logic, we have used a collection of different fuzzy approaches for image processing.Fuzzy image processing is the collection of all approaches that understand, represent, and process the images, their segments, and features as fuzzy sets.

Fuzzy image processing uses

  • Image fuzzification
  • Modification of membership values
  • Image defuzzification

The technique which holds the highest priority is the modification of membership function. After the image data is transformed from a gray-level plane to the membership plane (fuzzification), appropriate fuzzy techniques modify the membership values. This can be done by fuzzy clustering, a fuzzy rule-based approach, a fuzzy integration approach, and so on.

Fuzzy Image processing is useful in representing uncertain data related to any image because of the following reasons: -

  • These techniques can govern the vagueness and ambiguity efficiently 
  • Fuzzy logic is easy to understand the reasoning involved are very 
  • The fuzzy method will be more suitable to manage the imperfection than the traditional way. The input of the fuzzy inference system (FIS) is the original image and composed of a high pass filter.

For our Image processing, we have used medical images like CT Scan and MRI. These biomedical images are being used within the healthcare facilities for patient diagnosis, guiding treatment, planning treatment, and observing illness progression. Medical imaging basically processes missing, uncertain, complementary, ambiguous, inconsistent, and distorted data.

We will be analyzing these medical images and drawing conclusions using the Fuzzy Logic Toolbox. As the fuzzy logic act is a combined system for processing and representing numerical and symbolic data, and also the structural information, the fuzzy sets theory act as an intriguing and valuable tool, as it gives an excellent hypothetical basis to represent imprecision of the information.

Now let's understand what these Medical Images are.

CT Scan

A computerized tomography (CT) scan creates detailed images of the internal parts of the body by using X-rays. CT scans are sometimes referred to as CAT scans or computed tomography scans. CT Scans are done when there is damage to bones, injuries to internal organs, problems with blood flow, stroke, and cancer.

CT scans can help determine the location, size, and shape of a tumor before having radiotherapy, or allow a doctor to take a needle biopsy (where a small tissue sample is removed using a needle) or drain an abscess.

Medical_imaging_CT_Scan

Medical Imaging: CT Scan

MRI

Magnetic resonance imaging (MRI) is another scanning technique, is a type of scan that uses strong magnetic fields and radio waves to produce detailed images of the inside of the body.

An MRI scan can be used to examine almost any part of the body, including the brain and spinal cord, bones and joints, breasts, heart and blood vessels, internal organs, such as the liver, womb or prostate gland

The results of an MRI scan can be used to help diagnose conditions, plan treatments, and assess how effective previous treatment has been.

Medical_imaging_MRI

Medical Imaging: MRI

Image Processing Using Edge Detection

In image processing, edge detection technique is used for finding the boundaries of objects within the images. It works by detecting discontinuities in the intensity of an image. Edge detection is used for image segmentation and data extraction in areas such as image processing, computer vision, and machine vision.

Standard edge detection algorithms include

  • Sobel
  • Canny
  • Prewitt
  • Roberts
  • fuzzy logic methods.

For image processing, a vital stage is segmentation. Segmentation is a process that divides an image into several homogeneous regions. The division of the image is based on abrupt changes in the gray-level.

Implementation

Based on the following fuzzy rules, an edge detection algorithm can be developed and implemented:

  • if (Imgx is zero) and (Imgy is zero) then (Iout is white)

  • if (Imgx is zero) or (Imgy is zero) then (Iout is black).

PIC8

Applying the technique of edge detection

This is Fuzzy Logic-based edge detection for smooth and noisy CT and MRI scans. The edge detection is used to intensify the smoothness of the images. We have chosen Imgx and Imgy as the inputs, and then their conversion takes place in the fuzzy plane as defined by the fuzzy rules. This then leads to the defuzzification using the Mamdani inference.

Membership_Function

Obtaining the Membership functions of edge detection

The membership function is used for measuring the fuzziness. Our inputs are trapezoidal membership function, and output was the Gaussian MF. Our FIS variables include Imgx, Imgy, and Iout.

rule_editor

The rule editor helps us to define the rules, like here we have defined as if (Imgx is zero) and (Imgy is zero), then (Iout is white) similarly, if (Imgx is zero) or (Imgy is zero) then (Iout is black).

rule_viewer

The rule viewer has given us a roadmap of exactly what the inference process is happening. So here we can do 7 plots in one window. Here the rows having the plots are the set of rules, whereas the columns can be referred to as variables. The rules which we defined earlier are present in the status line and can be viewed by clicking on the rule number.

surface_viewer

Here we see a 3-dimensional surface that represents the Imgx, Imgy, and Iout. The surface viewer automatically gets updated on changing upon Input or Output variable. We have achieved the plot by specifying the rules for the fuzzy inference system, the membership functions which correspond to it, and the input and output as Imgx, Imgy, and Iout, respectively.

imgx
imgy
PIC15
PIC16
PIC17
PIC18
_PIC19
PIC20
PIC21

Image processing using image enhancement techniques

In image processing using image enhancement techniques, the most common method used is image binarization or enhancing directly through grayscale images. The steps involved in this process are: -

  • Normalization of the images
  • local orientation estimation
  • local frequency estimation
  • Filtering by designed Filters

The purpose behind normalizing the image is to decrease the dynamic range of the grayscale between ridges and valleys of the image estimation and the tuning of the filter parameters.

Implementation

Based on the following fuzzy rules, an image enhancement algorithm can be developed and implemented:

  • if (Img is dark) then (Iout is dark)

  • if (Img is gray) then (Iout is gray)

  • if (Img is bright) then (Iout is brighter).

PIC22

Through fuzzy enhancement techniques, we can obtain high-quality grayscale images that are generally degraded by impulsive noise during image acquisition or transmission. We have chosen Img as the input, and then its conversion takes place in the fuzzy plane as defined by the fuzzy rules. This then leads to the defuzzification using the Mamdani inference.

PIC23

The membership function is used for measuring the fuzziness. Our inputs are trapezoidal membership function, and output was the Gaussian MF. Our FIS variables include Imgx and Iout.

PIC24

The rule editor helps us to define the rules, like here we have defined as if (Img is dark) then (Iout is dark) similarly, if (Imgx is gray) then (Iout is gray) and if (Img is bright) then (Iout is brighter).

PIC25

The rule viewer has given us a roadmap of exactly what the inference process is happening. So here we can do 7 plots in one window. Here the rows having the plots are the set of rules, whereas the columns can be referred to as variables. The rules which we defined earlier are present in the status line and can be viewed by clicking on the rule number.

PIC26

We have achieved the output surface in a two-dimensional way by specifying the rules for the fuzzy inference system, the membership functions which correspond to it, and the input and output as Img and Iout, respectively.

PIC27
PIC28
PIC29
PIC30
PIC31
PIC32

Image Processing using Noise Reduction Techniques

As we all know that noise reduction is the process of removal of noise from a signal, so here the signal is our image and noise is the change in the pixel intensity of the image. Noise reduction algorithms tend to alter signals to a greater or lesser degree.

For the removal of noise, one of the most popular methods is the wiener filter. In this work, four types of noise (Gaussian noise, Salt & Pepper noise, Speckle noise, and Poisson noise) are used and image de-noising performed for different noise by Mean filter, Median filter, and Wiener filter.

Implementation

Based on the following fuzzy rules, an image enhancement algorithm can be developed and implemented:

  • if (Mean is zero) and (Median is zero) then (out is Homogenous)

  • if (Mean is not zero) and (Median is not zero) then (out is details)

PIC33

Through the Noise reduction techniques, we can obtain high-quality images after removal of noise. Noise basically means that the pixels of the image show different intensity values instead of the actual ones, which are generally during image acquisition or transmission. We have chosen the Mean and Median as our input, and then its conversion takes place in the fuzzy plane as defined by the fuzzy rules. This then leads to the defuzzification using the Mamdani inference.

PIC34

The membership function is used for measuring the fuzziness. Our inputs are trapezoidal membership function, and output was the Gaussian MF. Our FIS variables include Mean, Median, and Iout.

PIC35

The rule editor helps us to define the rules, like here we have defined as if (Mean is zero) and (Median is zero) then (out is Homogenous) similarly, if (Mean is not zero) and (Median is not zero) then (out is details).

PIC36

The rule viewer has given us a roadmap of exactly what the inference process is happening. So here we can do 7 plots in one window. Here the rows having the plots are the set of rules, whereas the columns can be referred to as variables. The rules which we defined earlier are present in the status line and can be viewed by clicking on the rule number.

PIC37

Here we see a 3-dimensional surface that represents the mean, median, and Iout. The surface viewer automatically gets updated on changing upon Input or Output variable. We have achieved the plot by specifying the rules for the fuzzy inference system, the membership functions which correspond to it, and the input and output as Mean, Median, and Iout, respectively.

PIC38
PIC39
PIC40
PIC41
PIC42
PIC43

C-means Clustering for Image Processing using Fuzzy Logic Toolbox

C-means clustering is a part of the image segmentation algorithm used for image processing using fuzzy logic. As in image segmentation, we take an image of interest and extracts portions of the image for ease of analysis and is widely used in medical and healthcare facilities. We will be analyzing brain tumors from MRI images of a cancerous patient. It works by counting the number of pixels in a tumor with excellent accuracy.

By using Fuzzy c-means clustering (FCM), the diagnosis becomes more manageable as it is an efficient way to calculate the number of pixels hence helping in diagnosing the tumor. This is done mainly by assigning the data points to multiple clusters. Each data point has an assigned degree of membership.

PIC44
PIC45

Conclusion

Fuzzy Image processing has proved to be useful in the field of medical and healthcare. The fuzzy set theory provides us with a suitable tool, which can represent the uncertainties arising in image processing and can model the relevant cognitive activity of human beings. The fuzzy approach has proved to be efficient as compared to other methods. The more important advantage of a fuzzy methodology lies in that the fuzzy membership function provides a natural means to model the uncertainty prevalent in an image scene.

Did you find some helpful content from our video or article and now looking for its code, model, or application? You can purchase the specific Title, if available, and instantly get the download link.

Thank you for reading this blog. Do share this blog if you found it helpful. If you have any queries, post them in the comments or contact us by emailing your questions to [email protected]. Follow us on LinkedIn Facebook, and Subscribe to our YouTube Channel. If you find any bug or error on this or any other page on our website, please inform us & we will correct it.

If you are looking for free help, you can post your comment below & wait for any community member to respond, which is not guaranteed. You can book Expert Help, a paid service, and get assistance in your requirement. If your timeline allows, we recommend you book the Research Assistance plan. If you want to get trained in MATLAB or Simulink, you may join one of our training modules. 

If you are ready for the paid service, share your requirement with necessary attachments & inform us about any Service preference along with the timeline. Once evaluated, we will revert to you with more details and the next suggested step.

Education is our future. MATLAB is our feature. Happy MATLABing!

The Blog has been created by Mayuri Parkhe along with contributions or modifications from Nikita Mahoviya.

About the author 

MayuriParkhe

Mayuri Parkhe is a MATLAB Developer at MATLAB Helper.
A B.E. graduate with an EXTC background from the University of Mumbai.
She believes if one wants to set off and go develop something brand new, he doesn't need millions of dollars of capitalization. All the person needs is a comfortable space around you and enough time to work on, and the dedication to go through with it.

  • Hamzah Arman Husni says:

    can i know what journal using this method?

  • Hamzah Arman Husni says:

    i mean the method of edge detection

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    MATLAB Helper ®

    Follow: YouTube Channel, LinkedIn Company, Facebook Page, Instagram Page

    Join Community of MATLAB Enthusiasts: Facebook Group, Telegram, LinkedIn Group

    Use Website Chat or WhatsApp at +91-8104622179

    >