本文整理汇总了C++中cam函数的典型用法代码示例。如果您正苦于以下问题:C++ cam函数的具体用法?C++ cam怎么用?C++ cam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cam函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: while
bool QCamFindShift_barycentre::registerFirstFrame() {
average_=0;
maximum_=0;
int i=cam().size().height()*cam().size().width();
const unsigned char * img=cam().yuvFrame().Y();
while (i-->0) {
unsigned char val=img[i];
if (val>maximum_) maximum_=val;
average_+=val;
}
average_/=cam().size().height()*cam().size().width();
return findBarycentre(lastBarycentre_);
}
开发者ID:thx8411,项目名称:qastrocam-g2,代码行数:13,代码来源:QCamFindShift_barycentre.cpp
示例2: main
int main(int argc, char** argv) {
video_resource cam(0);
calibrationParameters par = calibrateCamera(10, 7, 5 , cam);
par.saveToFile("calibration.xml");
return 0;
}
开发者ID:StephanRozendaal,项目名称:visio_dei,代码行数:7,代码来源:calibratie_schaakbord.cpp
示例3: cam
void eDeferredRenderer::_renderLightDistance(const eScene &scene, const eLight &light)
{
const eVector3 &lightPos = light.getPosition();
eRenderState &rs = eGfx->freshRenderState();
rs.colorWrite = eFALSE;
rs.vs = m_vsDistance;
rs.ps = m_psDistance;
rs.targets[0] = nullptr;
rs.depthTarget = m_texDistMap;
eGfx->clear(eCM_DEPTH, eCOL_WHITE);
eCamera cam(90.0f, 1.0f, 0.1f, light.getRange());
eMatrix4x4 cubeMtx, viewMtx;
static eRenderJobQueue jobs; // static to reduce memory allocations
for (eU32 i=0; i<eCMF_COUNT; i++)
{
if (light.getCastsShadows((eCubeMapFace)i))
{
rs.viewport.set(i*m_shadowSize, 0, (i+1)*m_shadowSize, m_shadowSize);
cubeMtx.cubemap(i);
viewMtx.identity();
viewMtx.translate(-lightPos);
viewMtx *= cubeMtx;
cam.setViewMatrix(viewMtx);
scene.getRenderJobs(cam, jobs);
jobs.render(cam, eRJW_RENDER_ALL & ~eRJW_SHADOWS_OFF & ~eRJW_ALPHA_ON, eRJF_MATERIALS_OFF);
}
}
}
开发者ID:enigmastudio,项目名称:Enigma-Studio-4,代码行数:34,代码来源:deferredrenderer.cpp
示例4: main
int main(int argc, char **argv) {
bool use_file = false;
std::string flag;
std::string filename;
int imgSize = atoi(argv[1]);
if (argc == 4) {
flag = std::string(argv[2]);
if (flag != "-f") {
std::cout << "Usage: " << argv[0] << " [-f filename]" << std::endl;
return 1;
}
filename = std::string(argv[3]);
use_file = true;
}
Scene scene;
Camera cam(Vector3D(-1.5, 1, 3), Vector3D(-0.3, 0.5, 0), Vector3D(0, 1, 0));
SceneReader reader;
if (use_file) {
std::ifstream f(filename.c_str());
reader.readScene(f, cam, scene);
}
else
reader.readScene(std::cin, cam, scene);
scene.render(cam, imgSize, std::cout);
return 0;
}
开发者ID:dflicker,项目名称:CPP_RayTracer,代码行数:26,代码来源:rt.cpp
示例5: sizeof
PAIS::Camera FileLoader::loadMvsCamera(ifstream &file) {
int fileNameLength;
char *fileName;
Vec3d center;
Vec2d focal;
Vec4d quaternion;
Vec2d principle;
double radialDistortion;
// read image file name length
file.read( (char*) &fileNameLength, sizeof(int) );
// read image file name
fileName = new char [fileNameLength+1];
file.read(fileName, fileNameLength);
fileName[fileNameLength] = '\0';
// read camera center
loadMvsVec(file, center);
// read camera focal length
loadMvsVec(file, focal);
// read camera principle point
loadMvsVec(file, principle);
// read rotation quaternion
loadMvsVec(file, quaternion);
// read radial distortion
file.read((char*) &radialDistortion, sizeof(double));
Camera cam(fileName, focal, principle, quaternion, center, radialDistortion);
delete [] fileName;
return cam;
}
开发者ID:yuhuangintel,项目名称:pais-mvs,代码行数:32,代码来源:fileloader.cpp
示例6: cam
BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
if (gViewerWindow->getRightMouseDown())
{
LLViewerCamera& cam(LLViewerCamera::instance());
mStartFOV = cam.getDefaultFOV();
gSavedSettings.setF32(
"ExodusAlternativeFOV",
mTargetFOV = clicks > 0 ?
llclamp(mTargetFOV += (0.05f * clicks), 0.1f, 3.0f) :
llclamp(mTargetFOV -= (0.05f * -clicks), 0.1f, 3.0f)
);
if (gSavedSettings.getBOOL("LiruMouselookInstantZoom"))
cam.setDefaultFOV(mTargetFOV);
else
mTimerFOV.start();
cam.mSavedFOVLoaded = false;
}
else if (clicks > 0)
{
gAgentCamera.changeCameraToDefault();
}
return TRUE;
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:26,代码来源:lltoolcomp.cpp
示例7: keyboardFunc
void keyboardFunc(unsigned char k, int, int)
{
switch (k)
{
case ' ' : {
g_pause = !g_pause;
break;
}
case 'c' : {
AffineSpace3f cam(g_camSpace.l,g_camSpace.p);
std::cout << "-vp " << g_camPos.x << " " << g_camPos.y << " " << g_camPos.z << " " << std::endl
<< "-vi " << g_camLookAt.x << " " << g_camLookAt.y << " " << g_camLookAt.z << " " << std::endl
<< "-vu " << g_camUp.x << " " << g_camUp.y << " " << g_camUp.z << " " << std::endl;
break;
}
case 'd' : {
g_demo_t0 = getSeconds();
g_demo_camSpace = AffineSpace3f::lookAtPoint(g_initial_camPos, g_initial_camLookAt, g_initial_camUp);
g_demo = !g_demo;
break;
}
case 'f' : glutFullScreen(); break;
case 'r' : g_refine = !g_refine; break;
case 't' : g_regression = !g_regression; break;
case 'l' : g_camRadius = max(0.0f, g_camRadius-1); break;
case 'L' : g_camRadius += 1; break;
case '\033': case 'q': case 'Q':
clearGlobalObjects();
glutDestroyWindow(g_window);
exit(0);
break;
}
g_resetAccumulation = true;
}
开发者ID:Joke-Dk,项目名称:smallupbp,代码行数:35,代码来源:glutdisplay.cpp
示例8: view
MVS_NAMESPACE_BEGIN
SingleView::SingleView(mve::View::Ptr _view)
:
view(_view)
{
if ((view.get() == NULL) || (!view->is_camera_valid()))
throw std::invalid_argument("NULL view");
viewID = view->get_id();
mve::MVEFileProxy const* proxy = 0;
proxy = view->get_proxy("tonemapped");
if (proxy == 0)
proxy = view->get_proxy("undistorted");
if (proxy == 0)
throw std::invalid_argument("No color image found");
mve::CameraInfo cam(view->get_camera());
cam.fill_camera_pos(*this->camPos);
cam.fill_world_to_cam(*this->worldToCam);
this->width = proxy->width;
this->height = proxy->height;
// compute projection matrix
cam.fill_calibration(*this->proj, width, height);
cam.fill_inverse_calibration(*this->invproj, width, height);
}
开发者ID:chaubold,项目名称:mve,代码行数:28,代码来源:SingleView.cpp
示例9: camConnected
void QCamSelection::camConnected() {
widget_->firtsFrameReceived_=false;
widget_->resize(cam().size());
widget_->updateGeometry();
mainWidget_->adjustSize();
setWindowTitle();
}
开发者ID:thx8411,项目名称:qastrocam-g2,代码行数:7,代码来源:QCamSelection.cpp
示例10: main
int
main()
{
vpSimulator simu ;
// Internal view initialization : view from the robot camera
simu.initInternalViewer(480, 360) ;
// External view initialization : view from an external camera
simu.initExternalViewer(300, 300) ;
// Inernal camera paramters initialization
vpCameraParameters cam(800,800,240,180) ;
simu.setInternalCameraParameters(cam) ;
vpTime::wait(500) ;
// Load the scene
std::cout << "Load : ./4Points.iv" << std::endl
<< "This file should be in the working directory" << std::endl;
simu.load("./4points.iv") ;
// Run the main loop
simu.initApplication(&mainLoop) ;
// Run the simulator
simu.mainLoop() ;
}
开发者ID:ILoveFree2,项目名称:visp-deb,代码行数:26,代码来源:manSimu4Dots.cpp
示例11: cam
bool VertexCam::read(std::istream& is)
{
// first the position and orientation (vector3 and quaternion)
Vector3d t;
for (int i=0; i<3; i++){
is >> t[i];
}
Vector4d rc;
for (int i=0; i<4; i++) {
is >> rc[i];
}
Quaterniond r;
r.coeffs() = rc;
r.normalize();
// form the camera object
SBACam cam(r,t);
// now fx, fy, cx, cy, baseline
double fx, fy, cx, cy, tx;
// try to read one value
is >> fx;
if (is.good()) {
is >> fy >> cx >> cy >> tx;
cam.setKcam(fx,fy,cx,cy,tx);
} else{
开发者ID:AIRLab-POLIMI,项目名称:ROAMFREE,代码行数:28,代码来源:types_sba.cpp
示例12: main
int main(int argc, char *argv[]){
int w=1024, h=768, samps = argc==2 ? atoi(argv[1])/4 : 1; // # samples
Ray cam(Vec(50,52,295.6), Vec(0,-0.042612,-1).norm()); // cam pos, dir
Vec cx=Vec(w*.5135/h), cy=(cx%cam.d).norm()*.5135, r, *c=new Vec[w*h];
#pragma omp parallel for schedule(dynamic, 1) private(r) // OpenMP
for (int y=0; y<h; y++){ // Loop over image rows
// *** Commented out for Visual Studio, fprintf is not thread-safe
//fprintf(stderr,"\rRendering (%d spp) %5.2f%%",samps*4,100.*y/(h-1));
unsigned short Xi[3]={0,0,y*y*y}; // *** Moved outside for VS2012
for (unsigned short x=0; x<w; x++) // Loop cols
for (int sy=0, i=(h-y-1)*w+x; sy<2; sy++) // 2x2 subpixel rows
for (int sx=0; sx<2; sx++, r=Vec()){ // 2x2 subpixel cols
for (int s=0; s<samps; s++){
double r1=2*erand48(Xi), dx=r1<1 ? sqrt(r1)-1: 1-sqrt(2-r1);
double r2=2*erand48(Xi), dy=r2<1 ? sqrt(r2)-1: 1-sqrt(2-r2);
Vec d = cx*( ( (sx+.5 + dx)/2 + x)/w - .5) +
cy*( ( (sy+.5 + dy)/2 + y)/h - .5) + cam.d;
r = r + radiance(Ray(cam.o+d*140,d.norm()),0,Xi)*(1./samps);
} // Camera rays are pushed ^^^^^ forward to start in interior
c[i] = c[i] + Vec(clamp(r.x),clamp(r.y),clamp(r.z))*.25;
}
}
FILE *f = fopen("image.ppm", "w"); // Write image to PPM file.
fprintf(f, "P3\n%d %d\n%d\n", w, h, 255);
for (int i=0; i<w*h; i++)
fprintf(f,"%d %d %d ", toInt(c[i].x), toInt(c[i].y), toInt(c[i].z));
}
开发者ID:andriskaaz,项目名称:smallpt-cplusplus,代码行数:27,代码来源:smallpt.cpp
示例13: main
int main(int argc, char **argv){
Camera cam(0);
Screen screen;
BeagleTracker tracker;
Mat img;
Rect2d bounderies = Rect2d(100, 100, 50, 50);
char c=0;
bool tracking = false;
bool initialized = false;
int skipFrames = 0;
while(c!=27){
img = cam.getImage();
if(c == 'p'){
tracking = !tracking;
}
if(tracking) {
if(!initialized){
tracker.initialTraining(img, bounderies);
initialized = !initialized;
}else if(skipFrames == 0){
tracker.update(img, bounderies);
}
}
skipFrames = (skipFrames+1)%12;
screen.drawRectangle(img, bounderies);
screen.putImage(img);
c = waitKey(10);
}
}
开发者ID:phonezawphyo,项目名称:bbb-server,代码行数:29,代码来源:testBeagleTracker.cpp
示例14: main
int main(int argc, char* argv[])
{
RoboCam cam(VIDEO_WIDTH, VIDEO_HEIGHT, TRUE);
int x, y ,size, key;
int frames = 0;
uint64_t start, end;
start = getUsecTime();
while (1) {
if ( cam.getObjectPosition( 100, &x, &y, &size, &key ) ) {
printf ( "S.%04d X.%04d Y.%04d\n", size, x, y);
}
frames++;
if ( key == 27 ) {
break;
}
}
end = getUsecTime();
printf("FPS: %2.3f\n", ((float)frames/(float)((end-start)/1000000)));
return 0;
}
开发者ID:bodoba,项目名称:Roomberry,代码行数:26,代码来源:CaptureTest.cpp
示例15: display
void display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glDepthMask( GL_TRUE );
glUseProgram( glutPro );
glUniformMatrix4fv(glGetUniformLocation( glutPro, "Projection" ), 1, GL_TRUE, projmat); //pass to shader
glUniformMatrix4fv(glGetUniformLocation( glutPro, "ModelView" ), 1, GL_TRUE, modelViewStack.top());
glUseProgram( arrayPro );
glUniformMatrix4fv(glGetUniformLocation( arrayPro, "Projection" ), 1, GL_TRUE, projmat); //pass to shader
glUniformMatrix4fv(glGetUniformLocation( arrayPro, "ModelView" ), 1, GL_TRUE, modelViewStack.top());
glUseProgram( skyPro );
glUniformMatrix4fv(glGetUniformLocation( skyPro, "Projection" ), 1, GL_TRUE, projmat); //pass to shader
glUniformMatrix4fv(glGetUniformLocation( skyPro, "ModelView" ), 1, GL_TRUE, modelViewStack.top());
glUseProgram( cubeMapPro );
glUniformMatrix4fv(glGetUniformLocation( cubeMapPro, "Projection" ), 1, GL_TRUE, projmat); //pass to shader
glUniformMatrix4fv(glGetUniformLocation( cubeMapPro, "ModelView" ), 1, GL_TRUE, modelViewStack.top());
glUseProgram( carPro );
glUniformMatrix4fv(glGetUniformLocation( carPro, "Projection" ), 1, GL_TRUE, projmat); //pass to shader
glUniformMatrix4fv(glGetUniformLocation( carPro, "ModelView" ), 1, GL_TRUE, modelViewStack.top());
glPolygonMode(GL_FRONT, GL_FILL);
cam();
traverse( &nodes[Sky] ); //begin traverse the tree
glutSwapBuffers();
}
开发者ID:LucRyan,项目名称:Final-Village,代码行数:31,代码来源:Final-Village.cpp
示例16: get_cam_img
/*----------------------------------------------------------------------------
Captures an image from the webcam - gets raw image data + dimensions
----------------------------------------------------------------------------*/
void get_cam_img( void *&raw_data, int &width, int &height )
{
VideoCapture cam( 0 ); /* OpenCV Video Capture */
Mat frame; /* image captured from webcam */
Mat grayscale; /* image converted to grayscale */
/* get dimensions */
width = cam.get( CV_CAP_PROP_FRAME_WIDTH );
height = cam.get( CV_CAP_PROP_FRAME_HEIGHT );
/* check if we could get a capture */
if( !cam.read( frame ) )
{
dbg_msg( "Could not read from webcam" );
raw_data = NULL;
return;
}
/* convert to greysale */
cvtColor( frame, grayscale, CV_BGR2GRAY );
/* get the raw image data */
raw_data = malloc( sizeof( char ) * grayscale.rows * grayscale.cols );
memcpy( raw_data, grayscale.data, sizeof( char ) * grayscale.rows * grayscale.cols);
cam.release();
}
开发者ID:utk-robotics-2016,项目名称:utk-robotics-2016,代码行数:29,代码来源:read_img.cpp
示例17: mNotifyCb
int CameraHardwareStub::pictureThread()
{
if (mMsgEnabled & CAMERA_MSG_SHUTTER)
mNotifyCb(CAMERA_MSG_SHUTTER, 0, 0, mCallbackCookie);
if (mMsgEnabled & CAMERA_MSG_RAW_IMAGE) {
//FIXME: use a canned YUV image!
// In the meantime just make another fake camera picture.
int w, h;
mParameters.getPictureSize(&w, &h);
sp<MemoryBase> mem = new MemoryBase(mRawHeap, 0, w * h * 3 / 2);
FakeCamera cam(w, h);
cam.getNextFrameAsYuv420((uint8_t *)mRawHeap->base());
mDataCb(CAMERA_MSG_RAW_IMAGE, mem, mCallbackCookie);
}
if (mMsgEnabled & CAMERA_MSG_COMPRESSED_IMAGE) {
sp<MemoryHeapBase> heap = new MemoryHeapBase(kCannedJpegSize);
sp<MemoryBase> mem = new MemoryBase(heap, 0, kCannedJpegSize);
memcpy(heap->base(), kCannedJpeg, kCannedJpegSize);
#error aa
LOGD("%d: %s() mem=%x, cook=%x", __LINE__, __FUNCTION__, (unsigned int)(void *)mem, mCallbackCookie);
mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, mCallbackCookie);
}
return NO_ERROR;
}
开发者ID:joyfish,项目名称:andriod_device_coolpad_d530,代码行数:26,代码来源:CameraHardwareStub.cpp
示例18: glPushAttrib
void IndexMap::predictIndices(const Eigen::Matrix4f & pose,
const int & time,
const std::pair<GLuint, GLuint> & model,
const float depthCutoff,
const int timeDelta)
{
indexFrameBuffer.Bind();
glPushAttrib(GL_VIEWPORT_BIT);
glViewport(0, 0, indexRenderBuffer.width, indexRenderBuffer.height);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
indexProgram->Bind();
Eigen::Matrix4f t_inv = pose.inverse();
Eigen::Vector4f cam(Intrinsics::getInstance().cx() * IndexMap::FACTOR,
Intrinsics::getInstance().cy() * IndexMap::FACTOR,
Intrinsics::getInstance().fx() * IndexMap::FACTOR,
Intrinsics::getInstance().fy() * IndexMap::FACTOR);
indexProgram->setUniform(Uniform("t_inv", t_inv));
indexProgram->setUniform(Uniform("cam", cam));
indexProgram->setUniform(Uniform("maxDepth", depthCutoff));
indexProgram->setUniform(Uniform("cols", (float)Resolution::getInstance().cols() * IndexMap::FACTOR));
indexProgram->setUniform(Uniform("rows", (float)Resolution::getInstance().rows() * IndexMap::FACTOR));
indexProgram->setUniform(Uniform("time", time));
indexProgram->setUniform(Uniform("timeDelta", timeDelta));
glBindBuffer(GL_ARRAY_BUFFER, model.first);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, Vertex::SIZE, 0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, Vertex::SIZE, reinterpret_cast<GLvoid*>(sizeof(Eigen::Vector4f)));
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, Vertex::SIZE, reinterpret_cast<GLvoid*>(sizeof(Eigen::Vector4f) * 2));
glDrawTransformFeedback(GL_POINTS, model.second);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);
glBindBuffer(GL_ARRAY_BUFFER, 0);
indexFrameBuffer.Unbind();
indexProgram->Unbind();
glPopAttrib();
glFinish();
}
开发者ID:HarveyLiuFly,项目名称:ElasticFusion,代码行数:59,代码来源:IndexMap.cpp
示例19: setWindowTitle
void QCamSelection::setWindowTitle() {
QString labelPrefix;
labelPrefix="Focus ";
if (isConnected() && mainWidget_) {
mainWidget_->setWindowTitle(labelPrefix+cam().label());
}
}
开发者ID:thx8411,项目名称:qastrocam-g2,代码行数:8,代码来源:QCamSelection.cpp
示例20: cam
//--------------------------------------------------------------
void Input::selectWebCam() {
input = nullptr;
enableClient = false;
unique_ptr<ofVideoGrabber> cam(new ofVideoGrabber);
cam->setup(640, 480);
source = move(cam);
isSetup = false;
}
开发者ID:ragnaringi,项目名称:Periscope,代码行数:9,代码来源:Input.cpp
注:本文中的cam函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论