本文整理汇总了C++中ofFile类的典型用法代码示例。如果您正苦于以下问题:C++ ofFile类的具体用法?C++ ofFile怎么用?C++ ofFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofFile类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getLastModified
// ---------------------------------------------------------------------------------------------------------------------------------------------------
//
std::time_t ofxAutoReloadedShader::getLastModified( ofFile& _file )
{
if( _file.exists() )
{
return std::filesystem::last_write_time(_file.path());
}
else
{
return 0;
}
}
开发者ID:andreasmuller,项目名称:ofxAutoReloadedShader,代码行数:13,代码来源:ofxAutoReloadedShader.cpp
示例2: getLastModified
std::time_t UIShader::getLastModified( ofFile& _file ){
if( _file.exists() ){
Poco::File& pocoFile = _file.getPocoFile();
Poco::Timestamp timestamp = pocoFile.getLastModified();
std::time_t fileChangedTime = timestamp.epochTime();
return fileChangedTime;
} else {
return 0;
}
}
开发者ID:patriciogonzalezvivo,项目名称:ofxPro,代码行数:11,代码来源:UIShader.cpp
示例3: processFile
//--------------------------------------------------------------
void ofApp::processFile(ofFile & file) {
cout << file.getAbsolutePath() << endl;
auto extension = ofToLower(file.getExtension());
cout << extension << endl;
if (extension == "jpg" || extension == "jpeg" || extension == "png") {
ofImage loader;
ofLogNotice("ofApp::dragEvent") << "loading " << file.getFileName() << " #" << decoder.getFrame();
loader.loadImage(file);
ofLogNotice("ofApp::dragEvent") << "adding " << file.getFileName();
decoder << loader;
} else if (extension == "sl") {
this->decoder.loadDataSet(file.getAbsolutePath());
}
}
开发者ID:elliotwoods,项目名称:Workshops.DigitalEmulsion,代码行数:15,代码来源:ofApp.cpp
示例4: getUpdateTime
long getUpdateTime(ofFile &file) {
struct stat fileStat;
if(stat(file.path().c_str(), &fileStat) < 0) {
printf("Couldn't stat file\n");
return;
}
return fileStat.st_mtime;
}
开发者ID:mazbox,项目名称:livecoding-audio,代码行数:9,代码来源:testApp.cpp
示例5: artvertSelected
//--------------------------------------------------------------
void ArtvertiserApp::artvertSelected(ofFile & artvertimg){
subs_img.setup( artvertimg.getAbsolutePath() );
state = Tracking;
artvertInfo.stop();
Artvert & artvert = artvertInfo.getCurrentArtvert();
if(artvert.hasAlias()){
artvertiser.setup(artvert.getAlias().getModel().getAbsolutePath(),grabber,subs_img.getImgQuad(), false, detectW, detectH );
ofLogVerbose("ArtvertiserApp", "artvert.hasAlias()");
}else{
ofLogVerbose("ArtvertiserApp", "doesn't: artvert.hasAlias()");
artvertiser.setup(artvert.getModel().getAbsolutePath(),grabber,subs_img.getImgQuad(), false, detectW, detectH );
}
}
开发者ID:TheArtvertiser,项目名称:TheArtvertiserCombined,代码行数:18,代码来源:ArtvertiserApp.cpp
示例6:
void ofImage_<PixelType>::saveImage(const ofFile & file, ofImageQualityType compressionLevel){
ofSaveImage(pixels,file.getAbsolutePath(),compressionLevel);
}
开发者ID:prettyextreme,项目名称:openFrameworks-0.7,代码行数:3,代码来源:ofImage.cpp
示例7: loadImage
bool ofImage_<PixelType>::loadImage(const ofFile & file){
return loadImage(file.getAbsolutePath());
}
开发者ID:prettyextreme,项目名称:openFrameworks-0.7,代码行数:3,代码来源:ofImage.cpp
示例8: load
bool ofImage_<PixelType>::load(const ofFile & file, const ofImageLoadSettings &settings){
return load(file.getAbsolutePath(), settings);
}
开发者ID:BaptisteTheoriz,项目名称:openFrameworks,代码行数:3,代码来源:ofImage.cpp
示例9: ofBackground
//--------------------------------------------------------------
void testApp::setup(){
ofBackground(0);
ofSetFrameRate(60);
int PORT = 12000;
int REMOTE_PORT = 12000;
string REMOTE_HOST = "169.254.0.1";
receiver.setup(PORT);
sender.setup(REMOTE_HOST, REMOTE_PORT);
sprintf(oscStatus, "[LOCALPORT] %d\n[REMOTE PORT] (%s, %5d)\n", PORT, REMOTE_HOST.c_str(), REMOTE_PORT);
gui.setup();
gui.addTitle("TRACKER \n[i] hide controls");
gui.addToggle("TRACK", bTracking).setSize(200, 20);
calibratedButton = &gui.addToggle("CALIBRATED", bCalibrated);
calibratedButton->setSize(200, 20);
gui.addToggle("SAVE", bSaving).setSize(200, 20);
gui.addButton("Load MeshLab File", bLoadMLP).setSize(200, 20);
gui.addButton("Reset Server Counter", bReset).setSize(200, 20);
gui.addSlider("Zoom", camZoom, -5000, 5000).setSmoothing(0.9);
gui.addSlider("camPosX", camPosX, -200, 200).setSmoothing(0.9);
gui.addSlider("camPosY", camPosY, -200, 200).setSmoothing(0.9);
gui.addSlider("camRotX", camRotX, 0, 360).setSmoothing(0.9);
gui.addSlider("camRotY", camRotY, 0, 360).setSmoothing(0.9);
gui.addToggle("Lock top view", bTop).setSize(200, 20);
gui.addToggle("Enable ghost 1", bGhost0).setSize(200, 20);
gui.addToggle("Enable ghost 2", bGhost1).setSize(200, 20);
gui.addButton("Set Center", bSetCenter).setSize(200, 20);
gui.addButton("Set Ref Point", bSetRefPoint).setSize(200, 20);
gui.addButton("Set Ghost 1", bSetGhost0).setSize(200, 20);
gui.addButton("Set Ghost 2", bSetGhost1).setSize(200, 20);
status = &gui.addTitle("STATUS");
status->setNewColumn(true);
gui.loadFromXML();
gui.show();
matrixData.setup();
// LOAD space references
XML.loadFile(ofToDataPath("xmlSettings.xml"));
int cX = XML.getValue("CENTER_X", 0);
int cZ = XML.getValue("CENTER_Z", 0);
int rX = XML.getValue("REF_X", 0);
int rZ = XML.getValue("REF_Z", 0);
center = ofVec3f(cX, 0, cZ);
refPoint = ofVec3f(rX, 0, rZ);
refVector = center - refPoint;
for(int i = 0; i < K; i++){
kinects[i].setMatrix(matrixData.getMatrix(i));
kinects[i].setCenter(center, refVector);
}
// LOAD GHOSTS
int gX, gZ;
gX = XML.getValue("GHOST_0_X", 0);
gZ = XML.getValue("GHOST_0_Z", 0);
ghost0 = ofVec3f(gX, 0, gZ);
gX = XML.getValue("GHOST_1_X", 0);
gZ = XML.getValue("GHOST_1_Z", 0);
ghost1 = ofVec3f(gX, 0, gZ);
//-----
bTracking = false;
bCalibrated = false;
bSaving = false;
pbSaving = false;
bReset = false;
bTop = false;
// Purge old osc messages
while(receiver.hasWaitingMessages()){
ofxOscMessage m;
receiver.getNextMessage(&m);
}
logFile.open("log.txt", ofFile::WriteOnly, false);
/*
AAAAAdasdasdadsa
bGhost0 = true;
bGhost1 = true;
*/
}
开发者ID:SopiMlab,项目名称:kinectTrackerRealTime,代码行数:100,代码来源:testApp.cpp
示例10: writeRaw
template <class T> void writeRaw(ofFile& out, T data) {
out.write((char*) &data, sizeof(data));
}
开发者ID:I33N,项目名称:ofxSick,代码行数:3,代码来源:ofxSick.cpp
示例11: readRaw
template <class T> void readRaw(ofFile& in, T& data) {
in.read((char*) &data, sizeof(data));
}
开发者ID:I33N,项目名称:ofxSick,代码行数:3,代码来源:ofxSick.cpp
示例12: CreateImage
// Create the clusters out of the image
ImgTexture ImgTextureFactory::CreateImage(const ofFile& inImageFile, const ofFile& inClusterFile)
{
std::cout << "\nCreating Image: " << inImageFile.getFileName() << "\n";
std::cout << "\nCreating Clustered Image: " << inClusterFile.getFileName() << "\n";
// First create an image out of the incoming file, this can have any format
ofImage image;
image.loadImage(inImageFile);
assert(image.isAllocated());
// Load our clustered image in a pixel buffer
ofPixels clustered_pix;
ofLoadImage(clustered_pix, inClusterFile.getFileName());
/*
// Load our sample image in a pixel buffer
ofPixels clustered_sample_pix;
ofLoadImage(clustered_pix, inClusterFile.getFileName());
*/
// Now create our clustered image, this needs to be of a type (rgba, 8bc)
assert(clustered_pix.isAllocated());
assert(clustered_pix.getImageType() == OF_IMAGE_COLOR_ALPHA);
assert(clustered_pix.getBitsPerPixel() == 32);
// Will hold the final amount of clusters
int cluster_counter = 0;
// Used for storing the color value
std::vector<BYTE> colors;
std::vector<int> color_refs;
// Now get the pixels and iterate over them
// We sample how many clusters there are in the image,
// The colors that belong to that cluster and how many times that color appears in the image
BYTE* pixels = clustered_pix.getPixels();
for (int x=0; x < clustered_pix.getWidth(); x++)
{
for(int y=0; y < clustered_pix.getHeight(); y++)
{
// Get the current read pos and sample color
int read_pos = ((y*clustered_pix.getWidth())+ x) * 4;
// Make sure alpha is not 0
if(pixels[read_pos+3] < 2)
continue;
BYTE color = pixels[read_pos];
// See if it's in the colors array, if not add
bool already_present = false;
int color_counter = 0;
for(std::vector<BYTE>::iterator it = colors.begin(); it != colors.end(); ++it)
{
// Get the color and sample within a range
BYTE p_color = *it;
if(!(color > *it+2) && !(color < *it-2))
{
already_present = true;
(color_refs[color_counter])++;
break;
}
// Increment color counter
color_counter++;
}
if(!already_present)
{
colors.push_back(color);
color_refs.push_back(1);
cluster_counter++;
}
}
}
// Now delete the clusters that don't have enough pixels
std::vector<BYTE> final_color_set;
int counter = 0;
int fclusters = 0;
for(std::vector<int>::iterator it = color_refs.begin(); it != color_refs.end(); ++it)
{
if(*it >= MIN_CLUSTER_PIXEL_COUNT)
{
final_color_set.push_back(colors[counter]);
fclusters++;
}
counter++;
}
// Sort the remaining ones based on color
vector<BYTE>::iterator it;
sort(final_color_set.begin(), final_color_set.end());
// Return a new texture that holds the image and clusters
return ImgTexture(image, clustered_pix, fclusters, final_color_set);
}
开发者ID:cklosters,项目名称:MikoVJ,代码行数:99,代码来源:ImgTextureFactory.cpp
示例13: watch
void watch(string vertName, string fragName)
{
vertShader.open(vertName);
fragShader.open(fragName);
ofAddListener(ofEvents().update, this, &AutoLoadShader::onUpdate);
}
开发者ID:KazuyoshiUeno,项目名称:ofxAlembic,代码行数:7,代码来源:testApp.cpp
示例14: onUpdate
void onUpdate(ofEventArgs &e)
{
if (lastVertTimestamp != vertShader.getPocoFile().getLastModified()
|| lastFragTimestamp != fragShader.getPocoFile().getLastModified())
{
reload();
}
}
开发者ID:KazuyoshiUeno,项目名称:ofxAlembic,代码行数:8,代码来源:testApp.cpp
示例15: writeLog
void testApp::writeLog(){
//-------------------------
// Writing machine learning data
if(bTracking && bCalibrated){
state = 0; // state is used for machine learning mark-up
if(keys['1']) state = 1;
if(keys['2']) state = 2;
// if(keys['3']) state = 3;
logFile << trackers[0].lerpedPos.x << " " << trackers[0].lerpedPos.z << " "
<< trackers[1].lerpedPos.x << " " << trackers[1].lerpedPos.z << " "
<< trackers[2].lerpedPos.x << " " << trackers[2].lerpedPos.z << " " << state << endl;
cout << trackers[0].lerpedPos.x << " " << trackers[0].lerpedPos.z << " "
<< trackers[1].lerpedPos.x << " " << trackers[1].lerpedPos.z << " "
<< trackers[2].lerpedPos.x << " " << trackers[2].lerpedPos.z << " " << state << endl;
logFile.flush();
}
}
开发者ID:SopiMlab,项目名称:kinectTrackerRealTime,代码行数:20,代码来源:testApp.cpp
示例16: reload
void reload()
{
load(vertShader.path(), fragShader.path());
}
开发者ID:KazuyoshiUeno,项目名称:ofxAlembic,代码行数:4,代码来源:testApp.cpp
注:本文中的ofFile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论