Skip to content

Instantly share code, notes, and snippets.

Volkan SALMA volkansalma

Block or report user

Report or block volkansalma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@volkansalma
volkansalma / anaglyph3d.c
Created Jun 30, 2012
Return an anaglyph image of a right and left channel
View anaglyph3d.c
// Return an anaglyph image of a right and left channel
// Author : Nicolas Bourré 20100927
IplImage * toAnaglyph(IplImage * imgLeft, IplImage *imgRight)
{
IplImage *iplReturn;
IplImage *l_R, * l_G, *l_B;
IplImage *r_R, * r_G, *r_B;
iplReturn = cvCreateImage( cvGetSize (imgLeft), 8, 3);
@volkansalma
volkansalma / coloredConsole.cpp
Created Jun 28, 2012
Colored console (windows)
View coloredConsole.cpp
#include <iostream>
#include <windows.h> // WinApi header
using namespace std; // std::cout, std::cin
int main()
{
HANDLE hConsole;
int k;
@volkansalma
volkansalma / atan2_approximation.c
Created Jun 22, 2012
optimized atan2 approximation
View atan2_approximation.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
float atan2_approximation1(float y, float x);
float atan2_approximation2(float y, float x);
int main()
{
float x = 1;
@volkansalma
volkansalma / gist:1170793
Created Aug 25, 2011
OpenCV 2.3 ile Optical Flow C++
View gist:1170793
#include <opencv2/opencv.hpp>
#include <iostream>
#include <vector>
#include <cmath>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
@volkansalma
volkansalma / optHints
Created Mar 27, 2011
optimizasyon ipuçları
View optHints
1- 32-bit data tiplerini kullanın. (Neden çünkü mimari bunun üzerine.
Bütün aritmatik işlem birimleri 32 bit için design edilmiş. Daha büyük veri tipleri bölünüp yapılır.
Küçük olanlarda 32 bitlik registerlara taşınır işaretli ise işaret genişletilir ekstra işlemler...)
2- Integer işlemlerinin işaretine önceden karar verin. Bölüm ve kalan hesaplarken, döngü sayaçları,
array indexleri için unsigned tipler, Integer-to-float dönüşümleri için signed tipler kullanın.
Kötü örnek:
double x; // MOV [tmep+4],0
unsigned int i; // MOV EAX, i
View opencvSVM.cpp
#include<iostream>
#include <cv.h>
#include <cxcore.h>
#include <ml.h>
using namespace std;
int main()
{
CvSVM SVM;
@volkansalma
volkansalma / hill.cpp
Created Mar 27, 2011
hill climbing algoritması
View hill.cpp
//f(bd) = |20 * bir_sayisi(bd) - 100| fonksiyonunu max yapan
// 30 karakterlik binary dizisinin(bd) hill climbing algoritmasi ile
//bulunmasi.
//Volkan SALMA. http://volkansalma.blogspot.com
#include <iostream>
#include <vector>
#include <stdlib.h> //for rand funct.
#include <time.h> //time for rand function seed.
#include <math.h> // for abs function
@volkansalma
volkansalma / tavlamaOutput
Created Mar 27, 2011
tavlama benzetimi sonucu
View tavlamaOutput
0 My Solution: SGGYVNFHLND@HEL@RFOYMGEO (143) Temp:99.6667
1 My Solution: SGGYHNFHLND@HEL@RFOYMGEO (129) Temp:99.3333
2 My Solution: SGGYHNFHLND@HEL@RFOYAGEO (117) Temp:99
3 My Solution: SGGYHNRHLND@HEL@RFOYAGEO (105) Temp:98.6667
4 My Solution: SGGLHNRHLND@HEL@RFOYAGEO (92) Temp:98.3333
5 My Solution: SGGLHNRHLND@HEL@RFOYAGRO (85) Temp:98
6 My Solution: SGGLHNRHLND@HEL@RMOYAGRO (78) Temp:97.6667
7 My Solution: SGGLHNRHLND@HML@RMOYAGRO (72) Temp:97.3333
8 My Solution: SNGLHNRHLND@HML@RMOYAGRO (65) Temp:97
9 My Solution: SNGLBNRHLND@HML@RMOYAGRO (59) Temp:96.6667
@volkansalma
volkansalma / tavlama.cpp
Created Mar 27, 2011
tavlama benzetimi örnek kod
View tavlama.cpp
//Simulated Annealing C++ Sample Code
//generates "VOLKANSALMA@BLOGSPOT@COM" string.
//inspired from http://www.generation5.org/content/2003/gahelloworld.asp
//by volkan salma
//http://volkansalma.blogspot.com
#include <iostream> // for cout etc.
#include <vector> // for vector class
#include <string> // for string class
#include <algorithm> // for sort algorithm
@volkansalma
volkansalma / genetikAlgoritma.cpp
Created Mar 27, 2011
genetik algoritma örnek kod
View genetikAlgoritma.cpp
#pragma warning(disable:4786) // disable debug warning
#include <iostream> // for cout etc.
#include <vector> // for vector class
#include <string> // for string class
#include <algorithm> // for sort algorithm
#include <time.h> // for random seed
#include <math.h> // for abs()
#define GA_POPSIZE 2048 // ga population size
You can’t perform that action at this time.