Posts

Showing posts from 2019

Face Recognize – MATLAB (With Source Code)

Image
As a beginner to MATLAB, I searched a source code for studying throughout the internet. But I could not find a complete source code for that. So, this is the source code for you who searching a MATLAB code for face recognize. 1.     Read Face %%Reading Face & Class of the face clc; close all ; [fname, path] = uigetfile( '.png' , 'Open a Face as input for Training' ); fname = strcat(path,fname); im = imread(fname); imshow(im); title( 'Input Face' ); c = input( 'Enter the class' ); %%Extracting Features & Saving F = FeatureStatistical(im); try     load db ;     F=[F c];     db=[db; F];     save db.mat db catch     db = [F c];     save db.mat db end 2.     Extracting Function %%Creating FeatureStatistical.m function [F]=FeatureStatistical(im) im=double(im); m=mean(im(:)); s=std(im(:)); F=[m s]; end 3.      Test Face %%Reading Face clc; close all ; [fname, path

Add Comment Sample Project

Image
Hi everyone, Today I am going to develop simple " Add Comment " project. I use following code to show comment icon. IconButton comment = IconButton( iconSize: 35.0 , icon: Icon(Icons. chat_bubble_outline ,color: Colors. grey ), onPressed: ()=> _commentButtonPressed(), );   return ListTile( leading: comment, ) class CommentScreen extends StatefulWidget { final String postId ; const CommentScreen(document, this . postId ); @override _CommentScreenState createState() => _CommentScreenState( postId: this . postId , ); } class _CommentScreenState extends State<CommentScreen> { final String postId ; final TextEditingController _commentController = TextEditingController(); _CommentScreenState({ this . postId }); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( "Comments" , style: TextStyle(color: Colors. black )

Like Button Sample Project

Image
Today I am going to build a Like button using flutter and fire-store. Actually this is not a button. It displays how to code for "Like Button" . Here I am using authenticate users and their user id. Here is the Sample Code for this project. class PublishPost extends StatefulWidget{    @override    _PublishPost createState() => new _PublishPost(); } class _PublishPost extends State<PublishPost> {   bool isPostLiked = false ;      @override      Widget _buildListItem (BuildContext context, DocumentSnapshot document) {       List<String> users;       Widget child;        if (document[ 'likedby' ].contains( '4' )) {         child = Text( 'Liked' );       } else {         child = Text( 'Like' );       }        return ListTile(         title: Row(           children: [             Expanded(               child: Text(                 document[ 'content' ],    

Simple Applet Project

Image
Code For The Project public class Assignment extends Applet implements Runnable  {         Image Picture;         public void init() {         Thread t = new Thread(this);         t.start();         Picture =  getImage(getDocumentBase(),"water.gif");     }         int i,j;         public void paint(Graphics g)         {                          resize(800,600);             drawPaint(i+20,200+j,g);             drawBoat(i+20,200+j,g);             drawBoat((-i)+800,200+j,g);             g.drawImage (Picture, 0, 300, this);             try {                 Thread.sleep(500);             } catch (InterruptedException ex) {                 Logger.getLogger(Assignment.class.getName()).log(Level.SEVERE, null, ex);             }                             }         public void drawBoat(int x,int y, Graphics g){              int z = x;               g.setColor(Color.gray);             int xpoint[] = {-20+z,200+z,80+

Web Cam Capture Program

Image
Hello everyone, in this post I am going to publish a web cam capture program using Java. 1.       First, you have to download OpenCV library using this link. ( https://opencv.org/releases/ ) 2.       Create a new NetBeans project and add OpenCV library. 3.       You can create your GUI now. 4.       This is the code for project import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; import javax.imageio.ImageIO; import javax.swing.JFileChooser; import java.io.ByteArrayInputStream; import javax.imageio.ImageIO; import javax.swing.JOptionPane; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfByte; import org.opencv.highgui.HighGui; import org.opencv.videoio.VideoCapture; import org.opencv.imgcodecs.Imgcodecs; public class Camera extends javax.swing.JFrame { private DaemonThread myThread = null; in

Basic Prolog (List)

1.       How to find last element from a list Code: lastelement([A],A). lastelement([_|A],B):- lastelement(A,B). Output: lastelement([a,b,c,d],X). X = d . 2.       How to find n th element of a list Code: element_at(X,[X|_],1). element_at(X,[_|T],Y):- element_at(X,T,Y1), Y is Y1+1. Output: element_at(X,[a,b,c,d],2). X = b . 3.       How to check whether the element available or not Code: mem([X|_],X). mem([_|T],X):- mem(T,X). Output: mem([a,b,c,d],a). true .  4.       How to print all members Code: mem([X|_],X). mem([_|T],X):- mem(T,X). Output: mem([a,b,c,d],X). X = a ; X = b ; X = c ; X = d ; false. There is a “Prolog” keyword to find member of list. We can use it directly. 4.1. ?- member(X,[a,b,c,d]). X = a ; X = b ; X = c ; X = d. 4.2. ?- member(b,[a,b,c,d]). True 5.       How to find the length of the list Code: list_length([],0). list_length([_|T],X):- list_length(T,X1),X is X1+1. O