This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ToolStripProgressBar ProgressBar = new ToolStripProgressBar(); | |
ProgressBar.Minimum = 0; //下限値 | |
ProgressBar.Maximum = 100; //上限値 | |
ProgressBar.Value = 0; //現在値 | |
ProgressBar.Style = ProgressBarStyle.Blocks; | |
statusStrip1.Items.Add(ProgressBar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IplImage* img_frame; | |
CvCapture* capture; | |
array<int,2>^data; | |
Bitmap^ bmp; | |
//カメラの接続確認 | |
if(capture==NULL){ | |
if((capture=cvCreateCameraCapture(-1))==NULL){ | |
MessageBox::Show("カメラが見つかりません"); | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (y = 0; y < img_frame->height; y++) { | |
for (x = 0; x < img_frame->width; x++) { | |
p[0] = img_frame->imageData[img_frame->widthStep * y + x * 3]; // B | |
p[1] = img_frame->imageData[img_frame->widthStep * y + x * 3 + 1]; // G | |
p[2] = img_frame->imageData[img_frame->widthStep * y + x * 3 + 2]; // R | |
img_frame->imageData[img_frame->widthStep * y + x * 3] = cvRound((p[0] + p[1] + p[2]) / 3); | |
img_frame->imageData[img_frame->widthStep * y + x * 3 + 1] = cvRound((p[0] + p[1] + p[2]) / 3); | |
img_frame->imageData[img_frame->widthStep * y + x * 3 + 2] = cvRound((p[0] + p[1] + p[2]) / 3); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int blue, green , red; | |
int tmp1, tmp2; | |
int x, y; | |
int size = 10;//モザイクサイズ | |
for(int y=0;y<img_frame->height;y+=size){ | |
for(int x=0;x<img_frame->width;x+=size){ | |
blue = 0; | |
green = 0; | |
red = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Socket ^myListenSocket; | |
Socket ^mySessionSocket; | |
NetworkStream ^myStream; | |
StreamReader ^myReader; | |
BinaryReader ^myBReader; | |
IPAddress ^myAddress; | |
int myPort; | |
EndPoint ^myEndPoint; | |
myListenSocket = gcnew Socket(AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IplImage2Array(IplImage* image){ | |
CvScalar color; | |
unsigned char r; | |
unsigned char g; | |
unsigned char b; | |
int rgb; | |
for(int y=0; y<image->height; y++){ | |
for(int x=0; x<image->width; x++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array2Bitmap(Bitmap^ bmp){ | |
Imaging::BitmapData^ bmpData; | |
unsigned char* pBmpSrc; | |
int wStep; | |
unsigned char r; | |
unsigned char g; | |
unsigned char b; | |
int rgb; | |
bmpData=bmp->LockBits( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cv.NamedWindow("sample", WindowMode.AutoSize); | |
CvCapture videoCapture = Cv.CreateCameraCapture(0); //ここはUSBカメラのID | |
//サイズを320,240にしておかないとエラーになる感じ | |
double w = 320, h = 240; | |
Cv.SetCaptureProperty(videoCapture, CaptureProperty.FrameWidth, w); | |
Cv.SetCaptureProperty(videoCapture, CaptureProperty.FrameHeight, h); | |
if (videoCapture == null){ | |
//ここでカメラがない場合のエラー処理 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void stream_InteractionFrameReady(object sender, InteractionFrameReadyEventArgs e){ | |
using (var interactionFrame = e.OpenInteractionFrame()){ | |
if (interactionFrame != null){ | |
var userInfos = new UserInfo[InteractionFrame.UserInfoArrayLength]; | |
interactionFrame.CopyInteractionDataTo(userInfos); | |
List<InteractionHandPointer> hands = new List<InteractionHandPointer>(); | |
foreach (var user in userInfos){ | |
if (user.SkeletonTrackingId != 0){ | |
foreach (var hand in user.HandPointers){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define swap(type, x, y) do { type t = x; x = y; y = t; } while (0) | |
/*--- クイックソート ---*/ | |
void quick(int a[], int left, int right){ | |
int pl = left; /* 左カーソル */ | |
int pr = right; /* 右カーソル */ | |
int x = a[(pl+pr)/2]; /* 枢軸は中央の要素 */ | |
int i; |