Posts

c++ - const-correctness of data-accessor types - better solution? -

i'm working on image-class makes possible work images different pixel layouts (rgb, rgba, gray, bayer, ...). access pixel it's possible call image.at<pixeltype>(x,y) returns "accessor". concrete accessor-implementation dependent on template argument. i've ran issues regarding const correctness. here dumbed down implementation makes apparent: template<bool constaccessor> class accessor { public: typedef typename boost::mpl::if_c<constaccessor, const int, int>::type datatype; accessor(datatype& data) :data(data) { } accessor(accessor<false>& other) : data(other.data) { } datatype& data; }; class image { public: accessor<false> at(unsigned int x, unsigned int y) { return accessor<false>(data); } accessor<true> at(unsigned int x, unsigned int y) const { return accessor<true>(data); } private: int data; }; int main() { im...

plot - R ggplot, two scales together -

i want y-axis scaled: by log10, used: scale_y_log10(breaks = trans_breaks("log10",function(x) 10^x)) more ticks: scale_y_continuous(breaks=pretty_breaks(10)) but error message, there can 1 scale. there way have both of 2 scales? if understand question right, want have y axis on log scale more ticks 1, 10, 100, etc. here's reproducible example describing tried: library(ggplot2) library(scales) dat <- data.frame(x=1:3, y=c(2,50,10000)) ggplot(data=dat, aes(x=x, y=y)) + geom_point() + scale_y_log10(breaks=trans_breaks("log10",function(x) 10^x)) + scale_y_continuous(breaks=pretty_breaks(10)) ## error: scale 'y' present. adding scale 'y', replace existing scale. ok, error says we're allowed 1 call scale_y_something . since want log scale, let's keep scale_y_log10 . our approach here depends on want achieve - work have more evenly spaced ticks along axis, if aren't nice round numbers? if so, can let pret...

How to use variable in JQuery select -

how modify jquery use var instead of '12'? var disableid = 12; if (e.currenttarget.checked) { $("input:checkbox[value=12]").attr("disabled", true); } else { $("input:checkbox[value=12]").attr("disabled", false); } you should use jquery's prop() method instead of attr() boolean values; there's no need if statements @ can set disabled state equal e.currenttarget.checked (which either true or false ): var disableid = 12, state = e.currenttarget.checked; $("input:checkbox[value='" + disableid + "']").prop("disabled", state);

Photo distorted in Html Need Help Rendering too 500x375 -

my photo in html not rendering long enough. photo less distorted pretty new html. original photo 500x375. hoping make render in html block exact dimensions. just set height , width attributes on img tag: <img src="myfile.jpg" width="500" height="375"/> that set dimensions 500x375 pixels. image should have these styles automatically though, it's image's styles being modified stylesheet. counteract this, can define inline style override other styles: <img src="myfile.jpg" style="width:500px;height:375"/> this override other styles applied image.

opencv: Manipulating edge-detected pixels -

i new opencv image processing. my task simple. have canny-edge detected image. have rid of edge-detected pixels. example, @ coordinates of (20,20), edge-detected pixel should eliminated. is there possibility solution? i thankful if of can guide me in solving this. thank much, karthik you can change parameters of canny edge detection , tune them needs. if want specific point or finite specific knows points want rid off access underlying pixel data , set 0. width = image.cols = y-position, j = x-position image.data[i*width + j] = 0.

c++ - boost::mpl::fold for double parameter abstraction -

i have class called carender, provides 1 carender::renderclientobject() method per given object type in clientobjecttypes. following code snipped shows running situation: #define unused(x) (void)(x) typedef boost::mpl::vector<model::clientmodel::cclientverticesobject, model::clientmodel::crawclientobject> clientobjecttypes; template <class t> struct methodforward{ virtual void renderclientobject(t* clientobject, controller::qtopengl::cqopenglcontext* glcontext) { unused(clientobject); unused(glcontext); }; }; struct base { template<class baseclass, class t> struct apply { struct deriverender: baseclass, methodforward<t> { virtual ~deriverender(){}; using baseclass::renderclientobject; using methodforward<t>::renderclientobject; }; typedef deriverender type; }; template<class t> ...

html5 - How to mark the copyright of an image in html? -

this semantic question. want put images copyrights on website. know figure , figcaption element, figcaption doesn't seem best tag that. it's rather caption need. if i've got image that: <figure> <img src="img/content/preview.jpg" alt="alttext für das bild" /> <figcaption>caption goes here</figcaption> </figure> where put copyright? edit: copyright text must visible. in general the copyright notice should contained in small element : […] typically features disclaimers, caveats, legal restrictions, or copyrights . if copyright notice applies content of sectioning content element (e.g., article ), include small element in footer element belongs sectioning element: a footer typically contains information about section such as wrote it, links related documents, copyright data , , like. if applies whole page, might include small element in footer belongs body (i.e. not nested in se...