galaxy_image.C: Importing an image and manipulating it | Image Processing | hsumanim.C: This script is a slightly modified version of hsum.C. |
//Create an image from a 2-D histogram and manipulate it //Author: Valeriy Onuchin void hist2image() { TCanvas *canv = new TCanvas("image", "xygaus + xygaus(5) + xylandau(10)"); canv->ToggleEventStatus(); canv->SetRightMargin(0.2); canv->SetLeftMargin(0.01); canv->SetTopMargin(0.01); canv->SetBottomMargin(0.01); // histogram as image (hist taken from draw2dopt.C) TImage *img = TImage::Create(); TF2 *f2 = new TF2("f2","(xygaus + xygaus(5) + xylandau(10))",-4,4,-4,4); Double_t params[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5, 3600,-2,0.7,-3,0.3}; f2->SetParameters(params); TH2D *h2 = new TH2D("h2","xygaus + xygaus(5) + xylandau(10)",100,-4,4,100,-4,4); h2->FillRandom("f2",40000); img->SetImage((const Double_t *)h2->GetArray(), h2->GetNbinsX() + 2, h2->GetNbinsY() + 2, gHistImagePalette); img->Draw(); img->StartPaletteEditor(); } hist2image.C:1 hist2image.C:2 hist2image.C:3 hist2image.C:4 hist2image.C:5 hist2image.C:6 hist2image.C:7 hist2image.C:8 hist2image.C:9 hist2image.C:10 hist2image.C:11 hist2image.C:12 hist2image.C:13 hist2image.C:14 hist2image.C:15 hist2image.C:16 hist2image.C:17 hist2image.C:18 hist2image.C:19 hist2image.C:20 hist2image.C:21 hist2image.C:22 hist2image.C:23 hist2image.C:24 hist2image.C:25 hist2image.C:26 |
|