Black n White

Embed Size (px)

Citation preview

  • 7/31/2019 Black n White

    1/1

    function [ out ] = blacknwhite( inp,color )%UNTITLED3 Summary of this function goes here% Detailed explanation goes here% inp(:,:,1)=(250/max(max(inp(:,:,1))))*inp(:,:,1);% inp(:,:,2)=(250/max(max(inp(:,:,2))))*inp(:,:,2);% inp(:,:,3)=(250/max(max(inp(:,:,3))))*inp(:,:,3);a=max(max(inp(:,:,1)));b=max(max(inp(:,:,2)));c=max(max(inp(:,:,3)));d=min(a,b);inp=(250/min(d,c))*inp;switch color

    case 1sel=1;oth1=2;oth2=3;

    case 2sel=2;oth1=1;oth2=3;

    case 3sel=3;oth1=2;oth2=1;

    otherwisedisp('please mention color RGB only');return

    end% inp(:,:,sel)=inp(:,:,sel);% inp(:,:,oth1)=0*inp(:,:,oth1);% inp(:,:,oth2)=0*inp(:,:,oth2);% inp=rgb2gray(inp);sz=size(inp);% threshold=min(max(inp))% if(threshold=(inp(i,j,oth2)+20))

    out(i,j)=1;if((inp(i,j,oth1)>230)||(inp(i,j,oth2)>230))

    out(i,j)=0;end

    elseout(i,j)=0;

    end% if(i==1)% inp(i,j)=1;% end

    endend